Módulo Label
src/app/modules/label/
Etiquetas para categorizar contactos o conversaciones.
Modelo — Label
| Campo | Tipo | Descripción |
|---|---|---|
_id | ObjectId | ID de MongoDB |
tenantId | ObjectId → Tenant | Tenant propietario |
name | string | Nombre de la etiqueta |
color | string | Color hex (#RRGGBB) |
icon | string | Icono (emoji o clase CSS) |
isActive | boolean | — |
createdAt | Date | — |
updatedAt | Date | — |
Endpoints
| Método | Ruta | Auth | Descripción |
|---|---|---|---|
GET | /api/v1/labels | @Auth() | Lista etiquetas (filtrable) |
GET | /api/v1/labels/:id | @Auth() | Obtiene una etiqueta |
POST | /api/v1/labels | @Auth() | Crea etiqueta |
PATCH | /api/v1/labels/:id | @Auth() | Actualiza etiqueta |
DELETE | /api/v1/labels/:id | @Auth() | Elimina etiqueta |
DTOs
CreateLabelDto
{
tenantId: string
name: string
color: string // '#RRGGBB'
icon?: string
}
FilterLabelDto / QueryLabelDto
Parámetros de filtro y paginación para el GET /labels.
Uso en el Frontend (NgRx)
El estado de labels se gestiona en el store Angular:
- Acción
loadLabels→ llamaGET /labels - Selector
selectAllLabels→ lista reactiva de labels - Acciones CRUD:
createLabel,updateLabel,deleteLabel