Fix posts and rework graphql errors
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -89,9 +89,12 @@ defmodule Mobilizon.Posts do
|
||||
"""
|
||||
@spec create_post(map) :: {:ok, Post.t()} | {:error, Ecto.Changeset.t()}
|
||||
def create_post(attrs \\ %{}) do
|
||||
%Post{}
|
||||
|> Post.changeset(attrs)
|
||||
|> Repo.insert()
|
||||
with {:ok, %Post{} = post} <-
|
||||
%Post{}
|
||||
|> Post.changeset(attrs)
|
||||
|> Repo.insert() do
|
||||
{:ok, Repo.preload(post, @post_preloads)}
|
||||
end
|
||||
end
|
||||
|
||||
@doc """
|
||||
|
||||
Reference in New Issue
Block a user