feat(web): complete audit log viewer with IP column and all event types

This commit is contained in:
SnapOtter
2026-06-13 16:42:10 +08:00
parent 3016571c2b
commit c6f9a29687
2 changed files with 33 additions and 4 deletions
+5
View File
@@ -12,6 +12,7 @@ export async function auditLogRoutes(app: FastifyInstance): Promise<void> {
page?: string;
limit?: string;
action?: string;
ip?: string;
from?: string;
to?: string;
};
@@ -30,6 +31,9 @@ export async function auditLogRoutes(app: FastifyInstance): Promise<void> {
if (request.query.action) {
conditions.push(eq(schema.auditLog.action, request.query.action));
}
if (request.query.ip) {
conditions.push(eq(schema.auditLog.ipAddress, request.query.ip));
}
if (request.query.from) {
const fromDate = new Date(request.query.from);
if (!Number.isNaN(fromDate.getTime())) {
@@ -68,6 +72,7 @@ export async function auditLogRoutes(app: FastifyInstance): Promise<void> {
targetId: e.targetId,
details: e.details ?? null,
ipAddress: e.ipAddress,
requestId: e.requestId ?? null,
createdAt: e.createdAt.toISOString(),
})),
total: countResult?.count ?? 0,