mobilizon.chapril.org-mobil.../lib/mobilizon/reports/note.ex
Thomas Citharel aef841e192 Introduce backend for reports
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2019-07-23 13:49:22 +02:00

28 lines
550 B
Elixir

defmodule Mobilizon.Reports.Note do
@moduledoc """
Report Note entity
"""
use Ecto.Schema
import Ecto.Changeset
alias Mobilizon.Actors.Actor
alias Mobilizon.Reports.Report
@attrs [:content, :moderator_id, :report_id]
@derive {Jason.Encoder, only: [:content]}
schema "report_notes" do
field(:content, :string)
belongs_to(:moderator, Actor)
belongs_to(:report, Report)
timestamps()
end
@doc false
def changeset(note, attrs) do
note
|> cast(attrs, @attrs)
|> validate_required(@attrs)
end
end