chore: initial commit for phase03

This commit is contained in:
hibna
2026-02-21 13:37:46 +03:00
parent 8eb7c90958
commit d0c20581b6
12 changed files with 1175 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
import type { FastifyRequest } from 'fastify';
import { auditLogs } from '@source/database';
import type { Database } from '@source/database';
export async function createAuditLog(
db: Database,
request: FastifyRequest,
data: {
organizationId: string;
action: string;
serverId?: string;
metadata?: Record<string, unknown>;
},
) {
await db.insert(auditLogs).values({
organizationId: data.organizationId,
userId: request.user.sub,
serverId: data.serverId,
action: data.action,
metadata: data.metadata ?? {},
ipAddress: request.ip,
});
}