1 defmodule Pleroma.Activity do
3 alias Pleroma.{Repo, Activity}
12 def get_by_ap_id(ap_id) do
13 Repo.one(from activity in Activity,
14 where: fragment("? @> ?", activity.data, ^%{id: ap_id}))
17 def all_by_object_ap_id(ap_id) do
18 Repo.all(from activity in Activity,
19 where: fragment("? @> ?", activity.data, ^%{object: %{id: ap_id}}))
22 def get_create_activity_by_object_ap_id(ap_id) do
23 Repo.one(from activity in Activity,
24 where: fragment("? @> ?", activity.data, ^%{type: "Create", object: %{id: ap_id}}))