W004: Delete user
Deletes the authenticated user's account from both Pharus and Firebase.
Steps
- Verify the Firebase token. Resolve the platform user row.
- Cascade-purge solely-owned orgs. For each org the user is the only active owner of, purge it (all tenant data, memberships, and the org row).
- Delete the platform user. Remove the
usersrow in one transaction; FKs cascade remaining memberships (co-owned orgs), API tokens, and invitations sent. - Delete the Firebase credential. Fire the Admin SDK
deleteUser(firebaseUid).
Returns
{ deletedId }.
Business rules
- Solely-owned orgs are purged. Each org the caller is the only owner of is cascade-deleted with all of its data; co-owned orgs survive for their other owners.
- Two-system delete. Both the platform row and the Firebase credential are removed.
Errors
NotFoundError. Nousersrow for the verified identity.