Add pagination to events, groups, partipants to an event and categories

lists
This commit is contained in:
Chocobozzz
2018-12-14 11:23:36 +01:00
parent 72dbc8c261
commit 48eb72cd4c
11 changed files with 92 additions and 72 deletions

View File

@@ -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})