feat: restringe soloAdmin (Bucefalo CRM) a agentes, default WhatsApp+fallbackEmail y archivado reversible

This commit is contained in:
urieljareth
2026-11-25 08:54:28 -06:00
parent 0d4f19f35d
commit 670265a390
31 changed files with 672 additions and 78 deletions
+20 -11
View File
@@ -25,16 +25,18 @@ model User {
}
model Cliente {
id String @id @default(cuid())
nombre String
empresa String?
id String @id @default(cuid())
nombre String
empresa String?
// Cargo de la persona de contacto (ej. "Director"). Solo informativo.
puesto String?
email String?
telefono String?
rfc String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
puesto String?
email String?
telefono String?
rfc String?
archivado Boolean @default(false)
archivadoAt DateTime?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
cotizaciones Cotizacion[]
// Cuenta de acceso al panel de cliente (role="cliente"). Una por cliente.
@@ -42,6 +44,7 @@ model Cliente {
programasPago ProgramaPago[]
@@index([nombre, empresa])
@@index([archivado])
}
model Cotizacion {
@@ -79,8 +82,10 @@ model Cotizacion {
rechazadaAt DateTime?
vencidaAt DateTime?
creadaPorAgente String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
archivado Boolean @default(false)
archivadoAt DateTime?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
cliente Cliente @relation(fields: [clienteId], references: [id])
asesor User @relation("AsesorCotizaciones", fields: [asesorId], references: [id])
@@ -94,6 +99,7 @@ model Cotizacion {
@@index([clienteId])
@@index([asesorId])
@@index([estado])
@@index([archivado])
@@index([createdAt])
}
@@ -148,6 +154,9 @@ model ServicioCatalogo {
variante String?
nivel String?
activo Boolean @default(true)
// Si es true, queda oculto para todas las claves de agentes/bots y solo puede
// agregarlo un administrador humano desde la web (p. ej. planes de Bucefalo CRM).
soloAdmin Boolean @default(false)
orden Int @default(0)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt