Use this file to discover all available pages before exploring further.
Inventory System keeps your team informed through a built-in notification system that creates targeted alerts whenever important inventory or user-management events occur. Notifications are stored in the database, scoped to the company, and optionally targeted at a specific user. A badge in the navigation header shows the unread count and updates on each page load.
The TipoNotificacion enum defines six event categories. The table below describes when each one fires:
Value
Fires when…
STOCK_BAJO
A product’s cantidad falls at or below stockMinimo + MARGEN_ALERTA_STOCK (i.e. quantity ≤ stockMinimo + 2) after a sale or movement. The product still has units remaining but is approaching the reorder threshold.
STOCK_CRITICO
A product’s cantidad falls at or below stockMinimo + MARGEN_ALERTA_STOCK (i.e. quantity ≤ stockMinimo + 2) — the same threshold as STOCK_BAJO. Generated by NotificacionesService.generarAlertasStock, which batches up to 10 critical-stock notifications at a time and includes a calculated purchase suggestion in the message body.
COTIZACION_POR_VENCER
A quote’s validaHasta is within 24 hours of the current time. Prompts the sales team to either convert the quote to a sale or contact the customer before the reservation automatically expires.
PRODUCTO_SIN_MOVIMIENTO
A product with a positive quantity has had no stock entries or exits for 30 or more days. Surfaces potentially forgotten or slow-moving inventory.
INVITACION_ACEPTADA
A user completed the invitation flow and joined the company. Allows admins to know when a pending invitation has been acted on.
USUARIO_REGISTRADO
A new user finished registration and is waiting for admin approval (their status is PENDIENTE). Prompts admins to review and activate the new account.
usuarioId is set to a specific user’s ID. Only that user sees the notification in their personal feed. Used for INVITACION_ACEPTADA and USUARIO_REGISTRADO events where the relevant audience is the admin who sent the invitation or triggered the registration flow.
Company-wide notifications
usuarioId is null. Every active user in the company sees the notification. Used for inventory alerts (STOCK_BAJO, STOCK_CRITICO, COTIZACION_POR_VENCER, PRODUCTO_SIN_MOVIMIENTO) where any team member may need to act.
When GET /api/notificaciones is called, the service returns both notifications directly addressed to the authenticated user and all company-wide notifications (those with usuarioId = null). This means a user always sees the full relevant picture without receiving notifications meant only for colleagues.
Calls NotificacionesService.marcarTodasLeidas, which updates all unread notifications for the authenticated user — both those directly addressed to them and company-wide ones — in a single updateMany call. Returns a Prisma BatchPayload with a count of how many records were updated:
{ "count": 7 }
Call GET /api/notificaciones?contador=true after marking all as read to confirm the badge count has dropped to zero before updating the UI.