# _MAP: MGN-008 - Notifications **Modulo:** MGN-008 **Nombre:** Notificaciones **Fase:** 02 - Core Business **Story Points:** 25 SP **Estado:** Parcialmente Implementado **Sprint:** 7 **Ultima actualizacion:** 2026-01-07 --- ## Resumen Sistema de notificaciones multi-canal (email, push, in-app, WebSocket) con templates y preferencias de usuario. Sprint 7 implemento el WebSocket Gateway para notificaciones en tiempo real. --- ## Metricas | Metrica | Valor | |---------|-------| | Story Points | 25 SP | | Requerimientos (RF) | 4 | | Especificaciones (ET) | 3 | | User Stories (US) | 4 | | Tablas DB | 6 (existentes en system) | | Endpoints API | WebSocket Gateway | | Tests | - | --- ## Requerimientos Funcionales | ID | Titulo | Prioridad | SP | |----|--------|-----------|---:| | [RF-NOTIF-001](./requerimientos/RF-NOTIF-001.md) | Notificaciones In-App | P0 | 8 | | [RF-NOTIF-002](./requerimientos/RF-NOTIF-002.md) | Notificaciones Email | P0 | 8 | | [RF-NOTIF-003](./requerimientos/RF-NOTIF-003.md) | Notificaciones Push | P1 | 5 | | [RF-NOTIF-004](./requerimientos/RF-NOTIF-004.md) | Preferencias de Notificacion | P1 | 5 | **Indice completo:** [INDICE-RF-NOTIF.md](./requerimientos/INDICE-RF-NOTIF.md) --- ## Especificaciones Tecnicas | ID | Archivo | Titulo | |----|---------|--------| | ET-NOTIF-backend | [ET-NOTIF-backend.md](./especificaciones/ET-NOTIF-backend.md) | Backend Services | | ET-NOTIF-frontend | [ET-NOTIF-frontend.md](./especificaciones/ET-NOTIF-frontend.md) | Frontend Components | | ET-NOTIF-database | [ET-NOTIF-database.md](./especificaciones/ET-NOTIF-database.md) | Database Schema | --- ## Historias de Usuario | ID | Titulo | Estado | |----|--------|--------| | US-MGN008-001 | Notificaciones In-App | Pendiente | | US-MGN008-002 | Notificaciones Email | Pendiente | | US-MGN008-003 | Notificaciones Push | Pendiente | | US-MGN008-004 | WebSocket Gateway | Implementado | --- ## Implementacion ### Database (Existente en system schema) | Objeto | Tipo | Schema | |--------|------|--------| | notifications | Tabla | system | | message_templates | Tabla | system | | messages | Tabla | system | | email_queue | Tabla | system | ### Backend (src/modules/notifications/) | Objeto | Tipo | Path | |--------|------|------| | NotificationGateway | Gateway | src/modules/notifications/websocket/notification.gateway.ts | | WebSocketTypes | Types | src/modules/notifications/websocket/websocket.types.ts | ### WebSocket Gateway | Evento | Descripcion | |--------|-------------| | connection | Cliente conectado | | notification | Emite notificacion a usuario/tenant | | tenant-notification | Broadcast a todo el tenant | | user-notification | Notificacion individual | ### Frontend (src/features/notifications/) | Componente | Path | |------------|------| | NotificationBell | src/features/notifications/components/NotificationBell.tsx | | NotificationDropdown | src/features/notifications/components/NotificationDropdown.tsx | | useNotificationSocket | src/features/notifications/hooks/useNotificationSocket.ts | | notificationsStore | src/features/notifications/stores/notifications.store.ts | ### Caracteristicas Implementadas (Sprint 7) - **Socket.IO Gateway:** Comunicacion bidireccional en tiempo real - **JWT Authentication:** Validacion de token en conexion WebSocket - **Room-based:** Rooms por tenant y usuario - **Event Emission:** Metodos para emitir a usuario, tenant o broadcast - **Notification Bell UI:** Icono con contador de no leidas - **Notification Dropdown:** Lista de notificaciones con acciones --- ## Dependencias **Depende de:** MGN-001 (Auth), MGN-002 (Users), MGN-004 (Tenants), MGN-006 (Settings) **Requerido por:** Modulos de negocio --- ## Trazabilidad Ver: [TRACEABILITY.yml](./implementacion/TRACEABILITY.yml) --- ## Changelog | Fecha | Sprint | Cambios | |-------|--------|---------| | 2026-01-07 | Sprint 7 | WebSocket Gateway + Frontend Notification Center | | 2025-12-05 | - | Documentacion RF inicial | --- **Generado por:** Requirements-Analyst **Implementado por:** Backend-Agent, Frontend-Agent (Sprint 7) **Fecha:** 2026-01-07