Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Created June 11, 2020 07:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save velotiotech/66182707c22f13532d3290d3aaca15cb to your computer and use it in GitHub Desktop.
Save velotiotech/66182707c22f13532d3290d3aaca15cb to your computer and use it in GitHub Desktop.
defmodule Graphql.Accounts.UserResolver do
alias Graphql.Accounts #import lib/graphql/accounts/accounts.ex as Accounts
def all(_args, _info) do
{:ok, Accounts.list_users()}
end
def find(%{email: email}, _info) do
case Accounts.get_user_by_email(email) do
nil -> {:error, "User email #{email} not found!"}
user -> {:ok, user}
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment