Commit 5d753e1c authored by kaniini's avatar kaniini

activity: add helpers for updating activities in the database

parent 6f90f2c3
defmodule Pleroma.Activity do
use Ecto.Schema
alias Pleroma.{Repo, Activity, Notification, Object}
import Ecto.Query
import Ecto.{Query, Changeset}
schema "activities" do
field(:data, :map)
......@@ -22,6 +22,13 @@ defmodule Pleroma.Activity do
)
end
def change(struct, params \\ %{}) do
struct
|> cast(params, [:data])
|> validate_required([:data])
|> unique_constraint(:ap_id, name: :activities_unique_apid_index)
end
# TODO:
# Go through these and fix them everywhere.
# Wrong name, only returns create activities
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment