feat(config): modulo Configuraciones admin + permisos por rol
- Tablas ConfiguracionSistema (7 configs) + RolConfiguracion (6 roles) - Endpoints: config/sistema GET/PATCH, config/roles GET/PATCH, config/usuarios GET/PATCH, config/reset-roles POST, config/acciones GET - modulosDeRol() async con fallback a MATRIZ estatica - auth/me devuelve acciones[] segun rol del usuario - saludMonday.estaDisponible() lee modo_local_forzado de DB (cache 30s) - Landing: vista Configuraciones con 4 tabs (Modo, Roles, Usuarios, Sistema) - Mi-dia: boton Descartar se deshabilita si !descartar_lead - 630 API tests + 24 landing tests + 20 mi-dia tests verdes Seed: npm run seed:config
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
-- Tablas de configuración del sistema y permisos por rol.
|
||||
-- Patrón manual: db execute + migrate resolve. NUNCA migrate dev.
|
||||
|
||||
-- CreateTable ConfiguracionSistema
|
||||
CREATE TABLE IF NOT EXISTS "ConfiguracionSistema" (
|
||||
"clave" TEXT NOT NULL PRIMARY KEY,
|
||||
"valor" TEXT NOT NULL,
|
||||
"updatedAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- CreateTable RolConfiguracion
|
||||
CREATE TABLE IF NOT EXISTS "RolConfiguracion" (
|
||||
"rol" TEXT NOT NULL PRIMARY KEY,
|
||||
"modulos" TEXT NOT NULL,
|
||||
"acciones" TEXT NOT NULL,
|
||||
"updatedAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
@@ -307,6 +307,19 @@ model AIDocumento {
|
||||
chunks AIChunk[]
|
||||
}
|
||||
|
||||
model ConfiguracionSistema {
|
||||
clave String @id
|
||||
valor String
|
||||
updatedAt DateTime @updatedAt @default(now())
|
||||
}
|
||||
|
||||
model RolConfiguracion {
|
||||
rol String @id
|
||||
modulos String // JSON array
|
||||
acciones String // JSON object
|
||||
updatedAt DateTime @updatedAt @default(now())
|
||||
}
|
||||
|
||||
model AIChunk {
|
||||
id String @id @default(uuid())
|
||||
documentoId String
|
||||
|
||||
Reference in New Issue
Block a user