57 lines
1.8 KiB
TypeScript
57 lines
1.8 KiB
TypeScript
/**
|
|
* Repository for persisting audit log entries to the database.
|
|
* Records user actions and system events for security and compliance tracking.
|
|
*/
|
|
/**
|
|
* Creates a new audit log entry.
|
|
* @param data - Audit log fields to persist.
|
|
* @param data.userId - Optional ID of the user who performed the action.
|
|
* @param data.action - Action identifier (e.g. login, withdrawal).
|
|
* @param data.resourceType - Optional type of resource affected.
|
|
* @param data.resourceId - Optional ID of the resource affected.
|
|
* @param data.ipAddress - Optional client IP address.
|
|
* @param data.userAgent - Optional client user-agent string.
|
|
* @param data.metadata - Optional additional context as key-value pairs.
|
|
* @returns Resolves when the row has been inserted.
|
|
*/
|
|
export declare function create(data: {
|
|
userId?: string | null;
|
|
action: string;
|
|
resourceType?: string | null;
|
|
resourceId?: string | null;
|
|
ipAddress?: string | null;
|
|
userAgent?: string | null;
|
|
metadata?: Record<string, unknown> | null;
|
|
}): Promise<void>;
|
|
export type AuditLogRow = {
|
|
id: string;
|
|
user_id: string | null;
|
|
action: string;
|
|
resource_type: string | null;
|
|
resource_id: string | null;
|
|
ip_address: string | null;
|
|
user_agent: string | null;
|
|
metadata: Record<string, unknown> | null;
|
|
created_at: Date;
|
|
};
|
|
export declare function listAuditLogs(filters: {
|
|
action?: string;
|
|
actions?: string[];
|
|
userId?: string;
|
|
from?: Date;
|
|
to?: Date;
|
|
limit?: number;
|
|
offset?: number;
|
|
}): Promise<{
|
|
items: AuditLogRow[];
|
|
total: number;
|
|
}>;
|
|
export declare function exportAuditLogsCsv(filters: {
|
|
action?: string;
|
|
actions?: string[];
|
|
userId?: string;
|
|
from?: Date;
|
|
to?: Date;
|
|
limit?: number;
|
|
}): Promise<string>;
|
|
//# sourceMappingURL=auditLogRepository.d.ts.map
|