38 lines
683 B
Elixir
38 lines
683 B
Elixir
defmodule Putzplan.Tasks.CompletedTask do
|
|
use Ash.Resource, otp_app: :putzplan, domain: Putzplan.Tasks, data_layer: AshSqlite.DataLayer
|
|
|
|
actions do
|
|
defaults [:read]
|
|
end
|
|
|
|
attributes do
|
|
uuid_primary_key :id
|
|
|
|
attribute :completion, :date do
|
|
allow_nil? false
|
|
end
|
|
|
|
attribute :user_id, :uuid do
|
|
allow_nil? false
|
|
end
|
|
|
|
attribute :task_id, :uuid do
|
|
allow_nil? false
|
|
end
|
|
end
|
|
|
|
relationships do
|
|
belongs_to :users, Putzplan.Accounts.User do
|
|
allow_nil? false
|
|
end
|
|
|
|
belongs_to :tasks, Putzplan.Tasks.Task do
|
|
allow_nil? false
|
|
end
|
|
end
|
|
|
|
sqlite do
|
|
table "completed_tasks"
|
|
repo Putzplan.Repo
|
|
end
|
|
end
|