fix(reportes): select con rol/activo para la lista de vendedores

This commit is contained in:
2026-09-17 07:19:45 +00:00
parent 8bcb093fec
commit 278a79c984

View File

@@ -75,7 +75,7 @@ export async function reporteLeads(req: Request, res: Response): Promise<void> {
where: { createdAt: rango, ...(vendedorId !== '' ? { usuarioId: vendedorId } : {}) }, where: { createdAt: rango, ...(vendedorId !== '' ? { usuarioId: vendedorId } : {}) },
orderBy: [{ usuarioId: 'asc' }, { createdAt: 'asc' }], orderBy: [{ usuarioId: 'asc' }, { createdAt: 'asc' }],
}) })
const usuarios = await prisma.usuario.findMany({ select: { id: true, nombre: true } }) const usuarios = await prisma.usuario.findMany({ select: { id: true, nombre: true, rol: true, activo: true } })
const nombrePorId = new Map(usuarios.map((u) => [u.id, u.nombre])) const nombrePorId = new Map(usuarios.map((u) => [u.id, u.nombre]))
res.json({ res.json({
vendedores: usuarios vendedores: usuarios