bdd181425b
Docker Compose project with automated Playwright benchmarks comparing django-liveview 2.2.0 against Phoenix LiveView 1.0 across 6 scenarios.
20 lines
454 B
Elixir
20 lines
454 B
Elixir
defmodule Benchmark.Alert do
|
|
use Ecto.Schema
|
|
import Ecto.Changeset
|
|
|
|
schema "alerts" do
|
|
field :alert_type, :string, default: "INFO"
|
|
field :description, :string
|
|
timestamps(type: :utc_datetime)
|
|
end
|
|
|
|
@types ~w(INFO WARNING CRITICAL)
|
|
|
|
def changeset(alert, attrs) do
|
|
alert
|
|
|> cast(attrs, [:alert_type, :description])
|
|
|> validate_required([:alert_type, :description])
|
|
|> validate_inclusion(:alert_type, @types)
|
|
end
|
|
end
|