games_app/backend/dist-test-faq/repositories/adminExportJobRepository.d.ts

49 lines
1.9 KiB
TypeScript

export type ExportJobStatus = 'queued' | 'running' | 'completed' | 'failed';
export type StoredExportRequest = Record<string, unknown>;
export type AdminExportJobRow = {
id: string;
requested_by: string;
status: ExportJobStatus;
progress: number;
row_count: number;
total_estimate: number | null;
error: string | null;
file_name: string | null;
file_path: string | null;
request_payload: StoredExportRequest;
format: 'xlsx' | 'csv' | 'pdf';
max_rows: number;
columns: string[];
job_kind: 'users' | 'reports';
report_key: string | null;
expires_at: Date;
created_at: Date;
started_at: Date | null;
completed_at: Date | null;
locked_at: Date | null;
locked_by: string | null;
};
export declare function createExportJob(input: {
id: string;
requestedBy: string;
fileName: string;
requestPayload: StoredExportRequest;
format: 'xlsx' | 'csv' | 'pdf';
maxRows: number;
columns: string[];
expiresAt: Date;
jobKind?: 'users' | 'reports';
reportKey?: string | null;
}): Promise<AdminExportJobRow>;
export declare function getExportJobForUser(jobId: string, requestedBy: string): Promise<AdminExportJobRow | null>;
export declare function claimNextQueuedJob(workerId: string): Promise<AdminExportJobRow | null>;
export declare function requeueStaleRunningJobs(staleMinutes?: number): Promise<number>;
export declare function requeueAllRunningJobs(): Promise<number>;
export declare function updateExportJobProgress(jobId: string, progress: number, rowCount: number, totalEstimate?: number | null): Promise<void>;
export declare function completeExportJob(jobId: string, filePath: string, rowCount: number): Promise<void>;
export declare function failExportJob(jobId: string, error: string): Promise<void>;
export declare function deleteExpiredExportJobs(): Promise<Array<{
id: string;
file_path: string | null;
}>>;
//# sourceMappingURL=adminExportJobRepository.d.ts.map