moving
Some checks failed
Installer Smoke / installer-smoke (push) Has been cancelled

This commit is contained in:
Oleg Maslov
2026-09-02 10:10:29 +02:00
commit 0c3e2ead3b
3841 changed files with 970576 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
import type { Job } from 'bullmq';
import type { Db } from '../../server/src/db/connection.js';
export interface JobData {
jobId: string;
teamId: string;
userId: string;
jobType: string;
input: Record<string, unknown>;
}
export type JobHandler = (job: Job<JobData>, db: Db) => Promise<Record<string, unknown>>;
export class JobProcessor {
private handlers = new Map<string, JobHandler>();
register(jobType: string, handler: JobHandler): void {
this.handlers.set(jobType, handler);
}
async process(job: Job<JobData>, db: Db): Promise<Record<string, unknown>> {
const handler = this.handlers.get(job.data.jobType);
if (!handler) {
throw new Error(`No handler registered for job type: ${job.data.jobType}`);
}
return handler(job, db);
}
}