31 lines
846 B
Elixir
31 lines
846 B
Elixir
|
defmodule FacesWeb.Resolvers.People do
|
||
|
alias Faces.Gallery
|
||
|
|
||
|
@doc """
|
||
|
This is the resolver callback for Absinthe to find a list of all people.
|
||
|
|
||
|
The arguments are:
|
||
|
|
||
|
* `parent`, any parent object which Absinthe things we're related to.
|
||
|
* `args`, any arguments passed to the query.
|
||
|
* `resolution`,
|
||
|
"""
|
||
|
def list_people(_parent, _args, _resolution) do
|
||
|
{:ok, Gallery.list_people()}
|
||
|
end
|
||
|
|
||
|
@doc """
|
||
|
This is the resolver callback Absinthe uses to create a person.
|
||
|
|
||
|
The arguments are:
|
||
|
|
||
|
* `parent` any parent object which Absinthe things we're related to.
|
||
|
* `args` a map of arguments passed to the query.
|
||
|
* `context` a context object which can be used for things like
|
||
|
authentication, etc.
|
||
|
"""
|
||
|
def create_person(_parent, %{username: username}, _context) do
|
||
|
Gallery.import_user(username)
|
||
|
end
|
||
|
end
|