From 01480586ff605b15874e9addda212fbc7e399c94 Mon Sep 17 00:00:00 2001 From: ilia Date: Sun, 4 Jan 2026 16:34:23 -0500 Subject: [PATCH] refactor: Update activity log details type for improved type safety - Changed the type of `details` in the ActivityLog interface and logActivity function from `Record` to `Record` to enhance type safety and clarity. - Updated the proxy function in Prisma client to use `keyof PrismaClient` for property access, improving type inference and reducing reliance on `any`. --- lib/activity-log.ts | 4 ++-- lib/prisma.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/activity-log.ts b/lib/activity-log.ts index f4ffacc..a4be39c 100644 --- a/lib/activity-log.ts +++ b/lib/activity-log.ts @@ -11,7 +11,7 @@ export interface ActivityLog { path: string method: string ip?: string - details?: Record + details?: Record } export function logActivity( @@ -19,7 +19,7 @@ export function logActivity( path: string, method: string, user?: { id: string; email: string; role: string } | null, - details?: Record, + details?: Record, request?: Request ) { const timestamp = new Date().toISOString() diff --git a/lib/prisma.ts b/lib/prisma.ts index cf5150f..2bb36f6 100644 --- a/lib/prisma.ts +++ b/lib/prisma.ts @@ -60,7 +60,7 @@ function getPrismaClient(): PrismaClient { export const prisma = new Proxy({} as PrismaClient, { get(_target, prop) { const client = getPrismaClient() - const value = (client as any)[prop] + const value = client[prop as keyof PrismaClient] return typeof value === 'function' ? value.bind(client) : value } })