Participation: Get for a user.
This commit is contained in:
parent
280172f6f6
commit
20d9b90760
3 changed files with 41 additions and 2 deletions
|
|
@ -8,6 +8,7 @@ defmodule Pleroma.Conversation.Participation do
|
|||
alias Pleroma.Conversation
|
||||
alias Pleroma.Repo
|
||||
import Ecto.Changeset
|
||||
import Ecto.Query
|
||||
|
||||
schema "conversation_participations" do
|
||||
belongs_to(:user, User, type: Pleroma.FlakeId)
|
||||
|
|
@ -50,4 +51,12 @@ defmodule Pleroma.Conversation.Participation do
|
|||
|> read_cng(%{read: false})
|
||||
|> Repo.update()
|
||||
end
|
||||
|
||||
def for_user(user, params \\ %{}) do
|
||||
from(p in __MODULE__,
|
||||
where: p.user_id == ^user.id,
|
||||
order_by: [desc: p.updated_at]
|
||||
)
|
||||
|> Pleroma.Pagination.fetch_paginated(params)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue