Skip to content

Commit

Permalink
chore(LoggedInUser): Minor improvements in graphql queries
Browse files Browse the repository at this point in the history
  • Loading branch information
Betree committed Apr 1, 2019
1 parent 52f371a commit 7397910
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 7 additions & 0 deletions apps/cf_graphql/lib/resolvers/users.ex
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ defmodule CF.Graphql.Resolvers.Users do
{:ok, user}
end

@doc """
Get logged in user
"""
def get_logged_in(_, _, _) do
{:ok, nil}
end

@doc """
Resolve main picture URL for `user`
"""
Expand Down
5 changes: 4 additions & 1 deletion apps/cf_graphql/lib/schema/schema.ex
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ defmodule CF.Graphql.Schema do

@desc "Get logged in user"
field :logged_in_user, :user do
middleware(Middleware.RequireAuthentication)
resolve(&Resolvers.Users.get_logged_in/3)
end

Expand All @@ -63,6 +62,8 @@ defmodule CF.Graphql.Schema do
mutation do
@desc "Use this to mark a notifications as seen"
field :update_notifications, list_of(:notification) do
middleware(Middleware.RequireAuthentication)

arg(:ids, non_null(list_of(:id)))
arg(:seen, non_null(:boolean))

Expand All @@ -71,6 +72,8 @@ defmodule CF.Graphql.Schema do

@desc "Use this to (un)subscribe from an item notifications"
field :update_subscription, :notifications_subscription do
middleware(Middleware.RequireAuthentication)

arg(:scope, non_null(:string))
arg(:entity_id, non_null(:id))
arg(:is_subscribed, non_null(:boolean))
Expand Down

0 comments on commit 7397910

Please sign in to comment.