Add pagination to events, groups, partipants to an event and categories
lists
This commit is contained in:
@@ -2,9 +2,9 @@ defmodule MobilizonWeb.Resolvers.Category do
|
||||
require Logger
|
||||
alias Mobilizon.Actors.User
|
||||
|
||||
def list_categories(_parent, _args, _resolution) do
|
||||
def list_categories(_parent, %{page: page, limit: limit}, _resolution) do
|
||||
categories =
|
||||
Mobilizon.Events.list_categories()
|
||||
Mobilizon.Events.list_categories(page, limit)
|
||||
|> Enum.map(fn category ->
|
||||
urls = MobilizonWeb.Uploaders.Category.urls({category.picture, category})
|
||||
Map.put(category, :picture, %{url: urls.original, url_thumbnail: urls.thumb})
|
||||
|
||||
@@ -2,8 +2,8 @@ defmodule MobilizonWeb.Resolvers.Event do
|
||||
alias Mobilizon.Service.ActivityPub
|
||||
alias Mobilizon.Actors
|
||||
|
||||
def list_events(_parent, _args, _resolution) do
|
||||
{:ok, Mobilizon.Events.list_events()}
|
||||
def list_events(_parent, %{page: page, limit: limit}, _resolution) do
|
||||
{:ok, Mobilizon.Events.list_events(page, limit)}
|
||||
end
|
||||
|
||||
def find_event(_parent, %{uuid: uuid}, _resolution) do
|
||||
@@ -26,8 +26,8 @@ defmodule MobilizonWeb.Resolvers.Event do
|
||||
@doc """
|
||||
List participants for event (through an event request)
|
||||
"""
|
||||
def list_participants_for_event(%{uuid: uuid}, _args, _resolution) do
|
||||
{:ok, Mobilizon.Events.list_participants_for_event(uuid)}
|
||||
def list_participants_for_event(%{uuid: uuid}, %{page: page, limit: limit}, _resolution) do
|
||||
{:ok, Mobilizon.Events.list_participants_for_event(uuid, page, limit)}
|
||||
end
|
||||
|
||||
@doc """
|
||||
|
||||
@@ -20,8 +20,8 @@ defmodule MobilizonWeb.Resolvers.Group do
|
||||
@doc """
|
||||
Lists all groups
|
||||
"""
|
||||
def list_groups(_parent, _args, _resolution) do
|
||||
{:ok, Actors.list_groups()}
|
||||
def list_groups(_parent, %{page: page, limit: limit}, _resolution) do
|
||||
{:ok, Actors.list_groups(page, limit)}
|
||||
end
|
||||
|
||||
@doc """
|
||||
|
||||
Reference in New Issue
Block a user