feat: add completed task
This commit is contained in:
parent
264484c256
commit
630aec22cf
2 changed files with 31 additions and 0 deletions
|
|
@ -3,5 +3,6 @@ defmodule Putzplan.Tasks do
|
|||
|
||||
resources do
|
||||
resource Putzplan.Tasks.Task
|
||||
resource Putzplan.Tasks.CompletedTask
|
||||
end
|
||||
end
|
||||
|
|
|
|||
30
lib/putzplan/tasks/completed_task.ex
Normal file
30
lib/putzplan/tasks/completed_task.ex
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
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
|
||||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue