Skip to main content
Version: v1.0.0(int)

W004: Delete user

Deletes the authenticated user's account from both Pharus and Firebase.

Steps

  1. Verify the Firebase token. Resolve the platform user row.
  2. 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).
  3. Delete the platform user. Remove the users row in one transaction; FKs cascade remaining memberships (co-owned orgs), API tokens, and invitations sent.
  4. 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. No users row for the verified identity.