activity: add helpers for updating activities in the database
This commit is contained in:
parent
6f90f2c3ac
commit
5d753e1c7c
1 changed files with 8 additions and 1 deletions
|
@ -1,7 +1,7 @@
|
||||||
defmodule Pleroma.Activity do
|
defmodule Pleroma.Activity do
|
||||||
use Ecto.Schema
|
use Ecto.Schema
|
||||||
alias Pleroma.{Repo, Activity, Notification, Object}
|
alias Pleroma.{Repo, Activity, Notification, Object}
|
||||||
import Ecto.Query
|
import Ecto.{Query, Changeset}
|
||||||
|
|
||||||
schema "activities" do
|
schema "activities" do
|
||||||
field(:data, :map)
|
field(:data, :map)
|
||||||
|
@ -22,6 +22,13 @@ def get_by_ap_id(ap_id) do
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def change(struct, params \\ %{}) do
|
||||||
|
struct
|
||||||
|
|> cast(params, [:data])
|
||||||
|
|> validate_required([:data])
|
||||||
|
|> unique_constraint(:ap_id, name: :activities_unique_apid_index)
|
||||||
|
end
|
||||||
|
|
||||||
# TODO:
|
# TODO:
|
||||||
# Go through these and fix them everywhere.
|
# Go through these and fix them everywhere.
|
||||||
# Wrong name, only returns create activities
|
# Wrong name, only returns create activities
|
||||||
|
|
Loading…
Reference in a new issue