All checks were successful
build / build (push) Successful in 11s
Implements a fully-featured action requests table in a single LiveView module using Flop, Ecto, and SQLite. Includes: - Fuzzy search, status/assignment filters, column sorting, 15-per-page pagination - Real-time updates, bookmarkable URLs via `handle_params/3` - JS-disabled fallback with GET forms (no duplicate logic) - 1,000,000 seeded records, Tailwind + DaisyUI styling, light/dark themes - Comprehensive README with comparisons to Django+React/Rails+React stacks - 31 tests covering all scenarios Tech: Phoenix 1.8+, LiveView, Flop, Ecto, SQLite, Elixir 1.15+
30 lines
828 B
Elixir
30 lines
828 B
Elixir
defmodule ActionRequestsDemo.ActionRequests.ActionRequest do
|
|
use Ecto.Schema
|
|
import Ecto.Changeset
|
|
|
|
@derive {
|
|
Flop.Schema,
|
|
filterable: [:patient_name, :status, :assigned_user_id],
|
|
sortable: [:patient_name, :status, :inserted_at, :delivery_scheduled_at],
|
|
default_limit: 15
|
|
}
|
|
|
|
@primary_key {:id, :binary_id, autogenerate: true}
|
|
@foreign_key_type :binary_id
|
|
schema "action_requests" do
|
|
field :patient_name, :string
|
|
field :status, :string
|
|
field :assigned_user_id, :integer
|
|
field :delivery_scheduled_at, :naive_datetime
|
|
|
|
timestamps(type: :utc_datetime)
|
|
end
|
|
|
|
@doc false
|
|
def changeset(action_request, attrs) do
|
|
action_request
|
|
|> cast(attrs, [:patient_name, :status, :assigned_user_id, :delivery_scheduled_at])
|
|
|> validate_required([:patient_name, :status])
|
|
end
|
|
end
|