Ajustes gerais - Etapa 1 #52

Merged
deyvisonwanderley merged 30 commits from ajustes_gerais into master 2025-12-01 18:00:39 +00:00
14 changed files with 3380 additions and 967 deletions
Showing only changes of commit f059a0c688 - Show all commits

View File

@@ -90,14 +90,33 @@ export const listarTodas = query({
.first(); .first();
let time = null; let time = null;
let gestor = null;
if (membroTime) { if (membroTime) {
time = await ctx.db.get(membroTime.timeId); 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 { return {
...ferias, ...ferias,
funcionario, funcionario,
time, time,
gestor,
}; };
}) })
); );