feat: add completed task

This commit is contained in:
Moritz Böhme 2025-04-04 21:25:08 +02:00
parent 264484c256
commit 630aec22cf
2 changed files with 31 additions and 0 deletions

View file

@ -3,5 +3,6 @@ defmodule Putzplan.Tasks do
resources do
resource Putzplan.Tasks.Task
resource Putzplan.Tasks.CompletedTask
end
end

View 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