feat: enhance party user auth endpoint with token validation, error logging, and security improvements
This commit is contained in:
@@ -1,28 +1,23 @@
|
||||
// src/app/services/AccessLog.service.ts
|
||||
// src/app/services/access-log.service.ts
|
||||
//
|
||||
// PURPOSE:
|
||||
// Service for handling AccessLog records
|
||||
// - Core service for audit logging and access tracking
|
||||
// - Records all authentication attempts and system access
|
||||
// - Provides query capabilities for audit trails
|
||||
// - Integrates with Prisma ORM for database operations
|
||||
//
|
||||
// RULES:
|
||||
// - All methods return Promises
|
||||
// - Input validation should be done at controller level
|
||||
// - Errors should be propagated to caller
|
||||
// - All methods return Promises for async operations
|
||||
// - Input validation must be done at controller level
|
||||
// - Errors should be propagated to caller with context
|
||||
// - Audit records should never be modified after creation
|
||||
// - Sensitive data should be hashed before logging
|
||||
// - Metadata should be stored as JSON for flexibility
|
||||
|
||||
import type { AccessLog } from '@prisma/client';
|
||||
|
||||
import prisma from '../lib/prisma';
|
||||
|
||||
// type CreateAccessLog = {
|
||||
// userId?: string;
|
||||
// message?: string;
|
||||
// metadata?: Record<string, any>;
|
||||
// };
|
||||
|
||||
// type UpdateAccessLog = {
|
||||
// status?: number;
|
||||
// metadata?: object;
|
||||
// };
|
||||
|
||||
async function listAccessLogs(): Promise<AccessLog[]> {
|
||||
return prisma.accessLog.findMany({
|
||||
orderBy: { timestamp: 'desc' },
|
||||
|
Reference in New Issue
Block a user