feat: enhance employee leave report generation by adding gestor information retrieval and improving filtering capabilities across components

This commit is contained in:
2025-11-29 20:21:40 -03:00
parent e9e7c654ee
commit f059a0c688
4 changed files with 1495 additions and 332 deletions

View File

@@ -90,14 +90,33 @@ export const listarTodas = query({
.first();
let time = null;
let gestor = null;
if (membroTime) {
time = await ctx.db.get(membroTime.timeId);
// Buscar gestor do time
if (time?.gestorId) {
const gestorUsuario = await ctx.db.get(time.gestorId);
if (gestorUsuario) {
// Buscar funcionário do gestor para obter o nome
const gestorFuncionario = await ctx.db
.query("funcionarios")
.withIndex("by_usuario", (q) => q.eq("usuarioId", time.gestorId))
.first();
if (gestorFuncionario) {
gestor = {
_id: gestorUsuario._id,
nome: gestorFuncionario.nome,
};
}
}
}
}
return {
...ferias,
funcionario,
time,
gestor,
};
})
);