Skip to content

Customer and employee deletion safety and deactivation #7

@NikosPoly

Description

@NikosPoly

Currently customers and employees can be hard deleted regardless of their loan history,
which would orphan loan records in MongoDB.

Two approaches are being considered — one needs to be chosen:

Option A — Loan history check before delete

  • Before deleting a customer, check if they have any loan history
  • If loan history exists, block deletion entirely

Option B — Soft delete via active boolean

  • Add active boolean field to Customer and Employee (default true)
  • Instead of deleting, set active = false
  • GET endpoints should only return active = true records by default
  • Preserves full loan history

Note

Option B is the preferred approach for a real library system but adds more complexity.
Decision needed before implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    business logicEnforces real world library domain rules and constraintshelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions