mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
feat(web): complete audit log viewer with IP column and all event types
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user