Fix posts and rework graphql errors

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2020-10-01 15:07:15 +02:00
parent 92367a5f33
commit aced4d039b
69 changed files with 1795 additions and 999 deletions

View File

@@ -20,6 +20,7 @@ defmodule Mobilizon.GraphQL.Schema do
alias Mobilizon.Actors.{Actor, Follower, Member}
alias Mobilizon.Discussions.Comment
alias Mobilizon.Events.{Event, Participant}
alias Mobilizon.GraphQL.Middleware.ErrorHandler
alias Mobilizon.GraphQL.Schema
alias Mobilizon.Storage.Repo
@@ -185,4 +186,12 @@ defmodule Mobilizon.GraphQL.Schema do
import_fields(:person_subscriptions)
import_fields(:discussion_subscriptions)
end
def middleware(middleware, _field, %{identifier: type}) when type in [:query, :mutation] do
middleware ++ [ErrorHandler]
end
def middleware(middleware, _field, _object) do
middleware
end
end