Download apps/api/src/services/audit.ts from safetrack/edtech: direct link, hf CLI and curl.
- Browser
- Download file 748 Bytes
-
https://huggingface.co/spaces/safetrack/edtech/resolve/main/apps/api/src/services/audit.ts
- Command line
-
hf download hf://spaces/safetrack/edtech/apps/api/src/services/audit.ts
-
curl -L -o audit.ts https://huggingface.co/spaces/safetrack/edtech/resolve/main/apps/api/src/services/audit.ts
748 Bytes
| import { prisma } from './prisma'; | |
| import { logger } from '../logger'; | |
| export const auditService = { | |
| /** | |
| * Log a sensitive action to the AuditLog table. | |
| */ | |
| async log(params: { | |
| action: string; | |
| actorId?: string; | |
| resourceId?: string; | |
| details?: Record<string, any>; | |
| }) { | |
| try { | |
| await prisma.auditLog.create({ | |
| data: { | |
| action: params.action, | |
| actorId: params.actorId, | |
| resourceId: params.resourceId, | |
| details: params.details || {} | |
| } | |
| }); | |
| } catch (err) { | |
| logger.error({ err, params }, '[AUDIT] Failed to save audit log'); | |
| } | |
| } | |
| }; | |