39 lines
1.4 KiB
TypeScript
39 lines
1.4 KiB
TypeScript
import { AmlAlert, AlertStatus, AmlPattern } from '../entities/aml-alert.entity';
|
|
|
|
export const AML_ALERT_REPOSITORY = Symbol('IAmlAlertRepository');
|
|
|
|
export interface IAmlAlertRepository {
|
|
create(data: Partial<AmlAlert>): AmlAlert;
|
|
save(alert: AmlAlert): Promise<AmlAlert>;
|
|
findById(id: string): Promise<AmlAlert | null>;
|
|
findAndCount(options: {
|
|
where?: Record<string, any>;
|
|
skip?: number;
|
|
take?: number;
|
|
order?: Record<string, 'ASC' | 'DESC'>;
|
|
}): Promise<[AmlAlert[], number]>;
|
|
find(options: {
|
|
where?: Record<string, any> | Record<string, any>[];
|
|
order?: Record<string, 'ASC' | 'DESC'>;
|
|
take?: number;
|
|
}): Promise<AmlAlert[]>;
|
|
count(options?: { where?: Record<string, any> | Record<string, any>[] }): Promise<number>;
|
|
update(id: string, data: Partial<AmlAlert>): Promise<void>;
|
|
|
|
/** Count alerts with risk_score >= threshold and not in resolved/dismissed status */
|
|
countHighRiskActive(threshold: number): Promise<number>;
|
|
|
|
/** Paginated query with optional status and pattern filters */
|
|
findPaginated(
|
|
page: number,
|
|
limit: number,
|
|
filters?: { status?: string; pattern?: string },
|
|
): Promise<[AmlAlert[], number]>;
|
|
|
|
/** Find alerts with risk_score >= threshold, ordered by score desc */
|
|
findSuspicious(page: number, limit: number, threshold: number): Promise<[AmlAlert[], number]>;
|
|
|
|
/** Count high-risk alerts (risk_score >= threshold) */
|
|
countHighRisk(threshold: number): Promise<number>;
|
|
}
|