Open
Description
User Story
As a system operator, I want payment orders to be soft deleted instead of permanently removed, to maintain data integrity and audit history while still allowing cleanup of old records.
Acceptance Criteria
-
GIVEN a payment order is deleted
WHEN using normal deletion
THEN the record is soft deleted by settingdeleted_at
-
GIVEN querying payment orders
WHEN no special context is provided
THEN only non-deleted records are returned -
GIVEN querying payment orders
WHEN using SkipSoftDelete context
THEN all records including soft-deleted ones are returned -
GIVEN a sender profile is deleted
WHEN the cascade delete triggers
THEN associated payment orders are soft deleted
Tech Details
- Create new
SoftDeleteMixin
in schema/mixins.go following Ent documentation for soft delete - Add SoftDeleteMixin to both LockPaymentOrder and PaymentOrder schemas
- Update PaymentOrder edge in SenderProfile to use
entsql.Cascade
- Add SkipSoftDelete context utility function
- Create database migration for new
deleted_at
field - Add soft delete functionality to
LockPaymentOrder
andPaymentOrder
schemas - Ignore writing tests for this ticket
Notes/Assumptions
- Both schemas currently use TimeMixin
- Multiple mixins can be combined
- Existing deletion logic will be replaced by soft delete
- Permanent deletion still possible with SkipSoftDelete context
Open Questions