Glossary
Push token (push-notification token) A string issued by Apple/Google (via the Expo push service) that uniquely identifies one installation of the Dentolize app on one device. The server sends this string to Expo along with a notification payload; Expo routes it to the right phone. Stored per-user as User.pushNotifications, a plain list of strings — a user can have several if they're logged into more than one device.
Session The record of one logged-in device/browser being allowed to act as a given user. Tracked two ways in Dentolize: a Redis-cached session (fast lookup, checked on every request) and a UserSession database row (durable record, includes metadata like IP address and the push token registered at that login). "Ending a session" means invalidating both.
UserSession vs. User.pushNotifications Easy to conflate, worth keeping separate. A UserSession row belongs to one login on one device, and stores the single push token that login registered (UserSession.pushNotification, singular). User.pushNotifications (plural) is the account-wide list built up across all of a user's logins — it's what actually gets used to send notifications, and it's what this PR clears. Deleting UserSession rows does not, by itself, remove anything from User.pushNotifications — that's exactly the gap this PR fixes for the mutations that previously only did the former.
Force-logout / session teardown When a Dentolize action other than a normal "Logout" click ends a user's session as a side effect — e.g. a password change invalidates all your other logged-in sessions as a security measure. Implemented as deleting the relevant UserSession row(s) and/or the Redis session cache.
Permission group A named bundle of permissions (e.g. "Reception," "Accountant," "Owners") assigned to one or more users. Editing or deleting a group affects every user currently in it at once — including, after this PR, clearing all of their push tokens.
Two-factor authentication (2FA) An optional extra login step (a time-based one-time code, TOTP) a user can enable on their own account, or that Dentolize support can forcibly disable for a locked-out user via the internal admin console.
disableCompany The mutation behind suspending (or re-enabling) an entire clinic's account — used for things like billing enforcement. Only available to Dentolize staff (isAdmin) or a clinic owner with the DO_ALL permission.
Internal admin console A separate, Dentolize-staff-only panel (distinct from the clinic-facing web app) used for cross-clinic operations like disabling a company or force-disabling a user's 2FA. Not reachable by clinic users.