The Notifications API delivers in-app alerts to the relevant staff roles whenever a key order event occurs. Notifications are created automatically by the order controller when an order’s status changes — no manual creation is required during normal operations. Each notification targets a specific role (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/FloresJesus/SS_RESTAURANT/llms.txt
Use this file to discover all available pages before exploring further.
usuario_destino), so kitchen staff see order-ready alerts, waiters see delivery cues, and admins receive confirmation when an order is delivered. The GET /api/notifications endpoint returns only the notifications that are relevant to the currently authenticated user’s role, together with the count of unread items. Any authenticated user can read and mark their own notifications; no specific role restriction is applied.
How notifications are created
Notifications are inserted automatically by the order status-change handler (PUT /api/orders/:id/status). The routing rules are:
Order status (status value sent) | DB estado_servicio | Notification tipo | Target role | Example message |
|---|---|---|---|---|
pending | pendiente | order_pending | cocina | ”Pedido #42 registrado” |
preparing | preparando | order_preparing | cocina | ”Pedido #42 esta siendo preparado” |
ready | listo | order_ready | mesero | ”Pedido #42 esta listo para entregar” |
delivered | entregado | order_delivered | admin | ”Pedido #42 ha sido entregado” |
notificaciones table with up to 20 most-recent entries returned per request (ordered by creado_en DESC).
Endpoints
| Method | Path | Auth | Description |
|---|---|---|---|
GET | /api/notifications | Any authenticated | List notifications for the current user’s role |
PUT | /api/notifications/:id/read | Any authenticated | Mark a single notification as read |
PUT | /api/notifications/read-all | Any authenticated | Mark all notifications for the current role as read |
GET /api/notifications
Returns the 20 most recent notifications relevant to the authenticated user’s role, along with the count of unread items. Notifications are matched byusuario_destino = <current user's role> or usuario_destino IS NULL (broadcast).
Array of notification objects for the authenticated user’s role. Maximum 20 items, newest first.
Total number of unread notifications for the current role. Use this to render a badge counter in the UI.
PUT /api/notifications/:id/read
Marks a single notification as read by settingleida = 1 on the specified record.
200 OK:
PUT /api/notifications/read-all
Marks every unread notification targeted at the authenticated user’s role as read in one operation. Equivalent to callingPUT /api/notifications/:id/read for each unread item, but more efficient.
200 OK:
Notifications cannot be created manually through this API. They are always generated automatically by the order status-change endpoint (
PUT /api/orders/:id/status). Standard operational notifications are driven by order state transitions only.The
usuario_destino field in the database stores the role name (e.g., "cocina", "mesero", "admin\"), not a specific user ID. All users sharing the same role will see the same notification in their feed.