refactor: Update activity log details type for improved type safety
All checks were successful
CI / skip-ci-check (pull_request) Successful in 1m23s
CI / lint-and-type-check (pull_request) Successful in 1m47s
CI / test (pull_request) Successful in 1m51s
CI / build (pull_request) Successful in 1m52s
CI / secret-scanning (pull_request) Successful in 1m24s
CI / dependency-scan (pull_request) Successful in 1m28s
CI / sast-scan (pull_request) Successful in 2m31s
CI / workflow-summary (pull_request) Successful in 1m21s

- Changed the type of `details` in the ActivityLog interface and logActivity function from `Record<string, any>` to `Record<string, unknown>` 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`.
This commit is contained in:
ilia 2026-01-04 16:34:23 -05:00
parent 889acd0bbd
commit 01480586ff
2 changed files with 3 additions and 3 deletions

View File

@ -11,7 +11,7 @@ export interface ActivityLog {
path: string
method: string
ip?: string
details?: Record<string, any>
details?: Record<string, unknown>
}
export function logActivity(
@ -19,7 +19,7 @@ export function logActivity(
path: string,
method: string,
user?: { id: string; email: string; role: string } | null,
details?: Record<string, any>,
details?: Record<string, unknown>,
request?: Request
) {
const timestamp = new Date().toISOString()

View File

@ -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
}
})