Make List report returns a paginated list

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2021-05-12 18:16:30 +02:00
parent 74778925e0
commit 8c53ea442f
2 changed files with 9 additions and 5 deletions

View File

@@ -76,7 +76,7 @@ defmodule Mobilizon.Reports do
@doc """
Returns the list of reports.
"""
@spec list_reports(integer | nil, integer | nil, atom, atom, ReportStatus) :: [Report.t()]
@spec list_reports(integer | nil, integer | nil, atom, atom, ReportStatus) :: Page.t()
def list_reports(
page \\ nil,
limit \\ nil,
@@ -86,9 +86,8 @@ defmodule Mobilizon.Reports do
) do
status
|> list_reports_query()
|> Page.paginate(page, limit)
|> sort(sort, direction)
|> Repo.all()
|> Page.build_page(page, limit)
end
@doc """