feat: add status management actions to MembershipFeeCycle
This commit is contained in:
parent
f39fd49af3
commit
48d98b97b2
2 changed files with 186 additions and 234 deletions
|
|
@ -51,6 +51,33 @@ defmodule Mv.MembershipFees.MembershipFeeCycle do
|
|||
primary? true
|
||||
accept [:status, :notes]
|
||||
end
|
||||
|
||||
update :mark_as_paid do
|
||||
description "Mark cycle as paid"
|
||||
require_atomic? false
|
||||
accept [:notes]
|
||||
change fn changeset, _context ->
|
||||
Ash.Changeset.force_change_attribute(changeset, :status, :paid)
|
||||
end
|
||||
end
|
||||
|
||||
update :mark_as_suspended do
|
||||
description "Mark cycle as suspended"
|
||||
require_atomic? false
|
||||
accept [:notes]
|
||||
change fn changeset, _context ->
|
||||
Ash.Changeset.force_change_attribute(changeset, :status, :suspended)
|
||||
end
|
||||
end
|
||||
|
||||
update :mark_as_unpaid do
|
||||
description "Mark cycle as unpaid (for error correction)"
|
||||
require_atomic? false
|
||||
accept [:notes]
|
||||
change fn changeset, _context ->
|
||||
Ash.Changeset.force_change_attribute(changeset, :status, :unpaid)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
attributes do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue