def post(user): post = Post() post.title = "Test Title" post.body = "this is the post body and can be as long as possible" user.posts().save(post) return post
def mutate(parent, info, post_details): user = User.find_or_fail(post_details.user_id) post = Post() post.title = post_details.title post.body = post_details.body user.posts().save(post) return post