1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.ReportNote do
11 alias Pleroma.Activity
13 alias Pleroma.ReportNote
16 @type t :: %__MODULE__{}
18 schema "report_notes" do
19 field(:content, :string)
20 belongs_to(:user, User, type: FlakeId.Ecto.CompatType)
21 belongs_to(:activity, Activity, type: FlakeId.Ecto.CompatType)
26 @spec create(FlakeId.Ecto.CompatType.t(), FlakeId.Ecto.CompatType.t(), String.t()) ::
27 {:ok, ReportNote.t()} | {:error, Changeset.t()}
28 def create(user_id, activity_id, content) do
31 activity_id: activity_id,
36 |> cast(attrs, [:user_id, :activity_id, :content])
37 |> validate_required([:user_id, :activity_id, :content])
41 @spec destroy(FlakeId.Ecto.CompatType.t()) ::
42 {:ok, ReportNote.t()} | {:error, Changeset.t()}
44 from(r in ReportNote, where: r.id == ^id)