CafeteriaPM enforces role-based access control on every protected endpoint using theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/123048152-JJDS/CafeteriaPM_S203/llms.txt
Use this file to discover all available pages before exploring further.
require_roles dependency. When you authenticate, your role is embedded in the JWT token under the rol claim. On each request the API validates that claim against the endpoint’s allowed-role list and returns 403 Forbidden if your role is not permitted — no client-side enforcement is relied upon.
Roles Overview
admin
Full system access. Manages users, products, tables, and orders. Accesses all statistics,
reports, and financial summaries. The only role that can create or delete user accounts.
mesero
Waiter role. Creates and tracks orders, manages table occupancy (occupy / free), and browses
the full product catalog. Cannot access financial data or user management.
caja
Cashier role. Processes payments via
POST /ventas/, registers expenses, views sales history,
and accesses the dashboard summary. Cannot create orders or manage inventory.cocina
Kitchen role. Views the kitchen queue, manages ingredients and inventory stock, registers
supply purchases, and can create or edit products. Cannot access financial or user data.
Permission Matrix
The table below maps key endpoints to the roles that may call them, derived directly from therequire_roles(...) guards in the source code.
| Endpoint | admin | mesero | caja | cocina |
|---|---|---|---|---|
GET /usuarios/ | ✅ | ❌ | ❌ | ❌ |
POST /usuarios/ | ✅ | ❌ | ❌ | ❌ |
GET /productos/ | ✅ | ✅ | ✅ | ✅ |
POST /productos/ | ✅ | ❌ | ❌ | ✅ |
DELETE /productos/{id} | ✅ | ❌ | ❌ | ❌ |
POST /pedidos/ | ✅ | ✅ | ❌ | ❌ |
PATCH /pedidos/{id}/estado | ✅ | ✅ | ✅ | ✅ |
DELETE /pedidos/{id} | ✅ | ❌ | ❌ | ❌ |
POST /ventas/ | ✅ | ❌ | ✅ | ❌ |
GET /ventas/ | ✅ | ❌ | ✅ | ❌ |
POST /gastos/ | ✅ | ❌ | ✅ | ❌ |
GET /gastos/ | ✅ | ❌ | ✅ | ❌ |
POST /mesas/ (create) | ✅ | ❌ | ❌ | ❌ |
PATCH /mesas/{id}/ocupar | ✅ | ✅ | ❌ | ❌ |
PATCH /mesas/{id}/liberar | ✅ | ✅ | ✅ | ❌ |
GET /compras/ | ✅ | ❌ | ❌ | ✅ |
POST /compras/ | ✅ | ❌ | ❌ | ✅ |
GET /stats/dashboard | ✅ | ❌ | ✅ | ❌ |
GET /stats/productos-estadisticas | ✅ | ❌ | ❌ | ❌ |
GET /stats/inventario-estado | ✅ | ❌ | ❌ | ✅ |
GET /stats/historial-actividad | ✅ | ❌ | ❌ | ❌ |
All authenticated users — regardless of role — can access the following read-only endpoints:
GET /productos/, GET /pedidos/, GET /pedidos/{id}, GET /mesas/, and
GET /pedidos/cola-cocina. These endpoints require a valid token but impose no role restriction.Managing Users
Only users with theadmin role can create, update, or delete user accounts through the /usuarios/ endpoints. When creating or updating a user, the role is set via the id_rol field, which maps to the roles table in the database. Role names are admin, mesero, caja, and cocina.
To create a new staff member you must be authenticated as an admin:
Getting Your Own Profile
Any authenticated user can retrieve their own profile without requiring theadmin role: