Add pagination to AdminAPI.AnnouncementController.index

This commit is contained in:
Tusooa Zhu 2022-03-08 21:26:05 -05:00
commit eb1a29640f
No known key found for this signature in database
GPG key ID: 7B467EDE43A08224
4 changed files with 78 additions and 2 deletions

View file

@ -61,6 +61,13 @@ defmodule Pleroma.Announcement do
|> Repo.all()
end
def list_paginated(%{limit: limited_number, offset: offset_number}) do
__MODULE__
|> limit(^limited_number)
|> offset(^offset_number)
|> Repo.all()
end
def get_by_id(id) do
Repo.get_by(__MODULE__, id: id)
end