Summary
Prevents database inconsistencies and profile breakage by restricting or gracefully handling the deletion of a user's active default profile card.
Contexts
Currently, the DELETE /cards/:id endpoint allows a user to delete any card belonging to them. If they delete their active default card (isDefault: true), the user profile is left without a default fallback state. This breaks core external entry points, such as primary QR code resolution and the public-facing web backup route (apps/web), which depend on a valid default card.
Tasks
Acceptance Criteria
Area
backend
Difficulty
Medium
Summary
Prevents database inconsistencies and profile breakage by restricting or gracefully handling the deletion of a user's active default profile card.
Contexts
Currently, the
DELETE /cards/:idendpoint allows a user to delete any card belonging to them. If they delete their active default card (isDefault: true), the user profile is left without a default fallback state. This breaks core external entry points, such as primary QR code resolution and the public-facing web backup route (apps/web), which depend on a valid default card.Tasks
DELETE /cards/:idrequests to check if the target card hasisDefault: true.isDefault: true.Acceptance Criteria
pnpm test:backend).Area
backendDifficulty
Medium