Glossary
Push token / pushNotifications A string identifier (an Expo push token, e.g. ExponentPushToken[...]) that a device registers with the server so it can receive push notifications. Stored as a String[] on both the User model (packages/prisma/schema.prisma:430) and the Patient model (packages/prisma/schema.prisma:966) — a user or patient can have more than one, since they may be logged in on multiple devices. Registration happens independently of login session state, which is exactly why it needed its own cleanup step in this PR.
Logout All Users The company-wide "sign everyone out" action, exposed to owners (DO_ALL permission) in clinic-web (Settings → Account → Security tab) and clinic-mobile (More menu). Backed by the logoutOutAllUsers GraphQL mutation. Ends every staff session in the company and — as of this PR — clears every staff push token in the company too.
DO_ALL permission The permission group Dentolize uses for owner-level, do-everything access. logoutOutAllUsers (and several other high-impact actions) require it; see packages/server/src/permissions/permissions.js:2787.
UserSession The database table tracking active sessions per user (as opposed to the session's live state, which lives in Redis under a sess:<id> key). logoutOutAllUsers deletes the Redis keys first (which actually ends the session for any in-flight request) and then deletes the matching UserSession rows so tracking stays in sync.
deleteSessions helper packages/server/src/utils/helpers.js:1988 — takes a list of session ID strings and deletes their corresponding sess:<id> keys from Redis, which is what Express-session actually checks on every request. This is the mechanism that makes a session termination take effect immediately, not just remove a database record.
Expo / expo-server-sdk The push notification service Dentolize's mobile app uses. Server-side notification code (notificationUtils.js, operationUtils.js) reads each user's pushNotifications array and sends through Expo's SDK, independent of whether that user currently has a valid session — which is the underlying reason stale tokens kept receiving alerts before this fix.