feat: implement error handling and logging in server hooks to capture and notify on 404 and 500 errors, enhancing server reliability and monitoring
This commit is contained in:
@@ -2919,14 +2919,30 @@ export const obterEstatisticasBancoHorasGerencial = query({
|
||||
const funcionariosComDetalhes = await Promise.all(
|
||||
bancosMensais.map(async (banco) => {
|
||||
const funcionario = await ctx.db.get(banco.funcionarioId);
|
||||
if (!funcionario) {
|
||||
return {
|
||||
...banco,
|
||||
funcionario: null
|
||||
};
|
||||
}
|
||||
|
||||
// Buscar foto do perfil do funcionário através do usuário associado
|
||||
let fotoPerfilUrl: string | null = null;
|
||||
const usuario = await ctx.db
|
||||
.query('usuarios')
|
||||
.withIndex('by_funcionarioId', (q) => q.eq('funcionarioId', funcionario._id))
|
||||
.first();
|
||||
if (usuario?.fotoPerfil) {
|
||||
fotoPerfilUrl = await ctx.storage.getUrl(usuario.fotoPerfil);
|
||||
}
|
||||
|
||||
return {
|
||||
...banco,
|
||||
funcionario: funcionario
|
||||
? {
|
||||
nome: funcionario.nome,
|
||||
matricula: funcionario.matricula
|
||||
}
|
||||
: null
|
||||
funcionario: {
|
||||
nome: funcionario.nome,
|
||||
matricula: funcionario.matricula,
|
||||
fotoPerfilUrl
|
||||
}
|
||||
};
|
||||
})
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user