deletedAt timestamp. Members with active loans cannot be deleted.
Authorization
Requires authentication with one of the following roles:- Admin: Can delete any member
- Supervisor: Can delete members in unions managed by their credit officers
- Credit Officer: Can delete members in their assigned unions only
Path Parameters
The unique identifier of the union member to delete
Response
Indicates if the deletion was successful
Success or error message
Deletion Rules
- Soft Delete: The member is not permanently removed. Instead, the
deletedAtfield is set to the current timestamp. - Active Loans Check: Members with active loans (where
deletedAtisnull) cannot be deleted. You must resolve all loans first. - Permission-Based: Users can only delete members they have permission to manage based on their role.
Error Scenarios
Member Has Active Loans
Member Has Active Loans
If the member has any active loans, the deletion will fail with a 400 error:You must complete, cancel, or otherwise resolve all loans before deleting the member.
Member Not Found
Member Not Found
If the member ID doesn’t exist or the member is already deleted:
Permission Denied
Permission Denied
If the user doesn’t have permission to delete this member:Or for supervisors:
Soft Delete: Deleted members are not permanently removed from the database. They can potentially be restored by updating their
deletedAt field to null through direct database access if needed.