Spaces:
Sleeping
Sleeping
Download src/utils/audit.ts from Anoderb/Tokiva-backend-Node: direct link, hf CLI and curl.
- Browser
- Download file 788 Bytes
-
https://huggingface.co/spaces/Anoderb/Tokiva-backend-Node/resolve/main/src/utils/audit.ts
- Command line
-
hf download hf://spaces/Anoderb/Tokiva-backend-Node/src/utils/audit.ts
-
curl -L -o audit.ts https://huggingface.co/spaces/Anoderb/Tokiva-backend-Node/resolve/main/src/utils/audit.ts
788 Bytes
| import prisma from './db'; | |
| interface AuditParams { | |
| userId?: number | null; | |
| aksi: string; | |
| entitas: string; | |
| entitasId?: number | null; | |
| dataLama?: any; | |
| dataBaru?: any; | |
| ipAddress?: string | null; | |
| userAgent?: string | null; | |
| } | |
| export const catatAudit = async (params: AuditParams) => { | |
| try { | |
| return await prisma.audit_log.create({ | |
| data: { | |
| user_id: params.userId ?? null, | |
| aksi: params.aksi, | |
| entitas: params.entitas, | |
| entitas_id: params.entitasId ?? null, | |
| data_lama: params.dataLama ?? null, | |
| data_baru: params.dataBaru ?? null, | |
| ip_address: params.ipAddress ?? null, | |
| user_agent: params.userAgent ?? null, | |
| }, | |
| }); | |
| } catch (error) { | |
| console.error('Gagal mencatat audit log:', error); | |
| } | |
| }; | |