Skip to content

Add Soft Delete for Payment Orders #401

Open
@chibie

Description

@chibie

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

  1. GIVEN a payment order is deleted
    WHEN using normal deletion
    THEN the record is soft deleted by setting deleted_at

  2. GIVEN querying payment orders
    WHEN no special context is provided
    THEN only non-deleted records are returned

  3. GIVEN querying payment orders
    WHEN using SkipSoftDelete context
    THEN all records including soft-deleted ones are returned

  4. 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 and PaymentOrder 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions