Created
June 11, 2020 07:35
-
-
Save velotiotech/66182707c22f13532d3290d3aaca15cb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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