Introduce backend for reports
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
27
lib/mobilizon/admin/action_log.ex
Normal file
27
lib/mobilizon/admin/action_log.ex
Normal file
@@ -0,0 +1,27 @@
|
||||
defmodule Mobilizon.Admin.ActionLog do
|
||||
@moduledoc """
|
||||
ActionLog entity schema
|
||||
"""
|
||||
use Ecto.Schema
|
||||
import Ecto.Changeset
|
||||
alias Mobilizon.Actors.Actor
|
||||
|
||||
@required_attrs [:action, :target_type, :target_id, :changes, :actor_id]
|
||||
|
||||
schema "admin_action_logs" do
|
||||
field(:action, :string)
|
||||
field(:target_type, :string)
|
||||
field(:target_id, :integer)
|
||||
field(:changes, :map)
|
||||
belongs_to(:actor, Actor)
|
||||
|
||||
timestamps()
|
||||
end
|
||||
|
||||
@doc false
|
||||
def changeset(action_log, attrs) do
|
||||
action_log
|
||||
|> cast(attrs, @required_attrs)
|
||||
|> validate_required(@required_attrs -- [:changes])
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user