Add ability to list users
This commit is contained in:
committed by
Thomas Citharel
parent
6ee3233cc6
commit
a0123459b3
@@ -24,6 +24,20 @@ defmodule MobilizonWeb.Resolvers.User do
|
||||
{:error, "You need to be logged-in to view current user"}
|
||||
end
|
||||
|
||||
@doc """
|
||||
List instance users
|
||||
"""
|
||||
def list_and_count_users(
|
||||
_parent,
|
||||
%{page: page, limit: limit, sort: sort, direction: direction},
|
||||
_resolution
|
||||
) do
|
||||
total = Task.async(&Actors.count_users/0)
|
||||
elements = Task.async(fn -> Actors.list_users(page, limit, sort, direction) end)
|
||||
|
||||
{:ok, %{total: Task.await(total), elements: Task.await(elements)}}
|
||||
end
|
||||
|
||||
@doc """
|
||||
Login an user. Returns a token and the user
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user