feat: enhance audit page by adding user information retrieval and improving CSV export format, providing better insights and clarity in reports

This commit is contained in:
2025-11-30 08:42:21 -03:00
parent 334676b860
commit f1c2ae0e6b
2 changed files with 133 additions and 41 deletions

View File

@@ -421,7 +421,29 @@ export const listarTodosLogins = query({
.order("desc")
.take(args.limite || 50);
return logs;
// Buscar informações dos usuários quando disponível
const logsComUsuarios = await Promise.all(
logs.map(async (log) => {
let usuarioNome: string | undefined = undefined;
let usuarioEmail: string | undefined = undefined;
if (log.usuarioId) {
const usuario = await ctx.db.get(log.usuarioId);
if (usuario) {
usuarioNome = usuario.nome;
usuarioEmail = usuario.email;
}
}
return {
...log,
usuarioNome,
usuarioEmail,
};
})
);
return logsComUsuarios;
},
});