feat: closing last gaps in backend functions we have available
This commit is contained in:
21
lib/bds/cli_sync/notification.ex
Normal file
21
lib/bds/cli_sync/notification.ex
Normal file
@@ -0,0 +1,21 @@
|
||||
defmodule BDS.CliSync.Notification do
|
||||
@moduledoc false
|
||||
|
||||
use Ecto.Schema
|
||||
import Ecto.Changeset
|
||||
|
||||
schema "db_notifications" do
|
||||
field :entity_type, :string
|
||||
field :entity_id, :string
|
||||
field :action, Ecto.Enum, values: [:created, :updated, :deleted]
|
||||
field :from_cli, :boolean, default: true
|
||||
field :seen_at, :integer
|
||||
field :created_at, :integer
|
||||
end
|
||||
|
||||
def changeset(notification, attrs) do
|
||||
notification
|
||||
|> cast(attrs, [:entity_type, :entity_id, :action, :from_cli, :seen_at, :created_at], empty_values: [nil])
|
||||
|> validate_required([:entity_type, :entity_id, :action, :from_cli, :created_at])
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user