Cycle Management & Member Integration closes #279 #294

Open
moritz wants to merge 49 commits from feature/279_cycle_management into main
Showing only changes of commit 032db2a4ba - Show all commits

View file

@ -62,10 +62,10 @@ defmodule Mv.MembershipFees.Changes.ValidateSameInterval do
add_interval_mismatch_error(changeset, current_interval, new_interval)
end
{:error, _reason} ->
# If we can't load the types, allow the change (fail open)
# The database constraint will catch invalid foreign keys
changeset
{:error, reason} ->
# Fail closed: If we can't load the types, reject the change
# This prevents inconsistent data states
add_type_validation_error(changeset, reason)
end
end
@ -114,6 +114,17 @@ defmodule Mv.MembershipFees.Changes.ValidateSameInterval do
)
end
# Add validation error when types cannot be loaded
defp add_type_validation_error(changeset, reason) do
message = "Could not validate membership fee type intervals: type not found"
Ash.Changeset.add_error(
changeset,
field: :membership_fee_type_id,
message: message
)
end
# Format interval atom to human-readable string
defp format_interval(:monthly), do: "monthly"
defp format_interval(:quarterly), do: "quarterly"