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:
@@ -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;
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user