This commit is contained in:
2026-06-30 10:33:56 +08:00
commit 6e047dc0a5
607 changed files with 65966 additions and 0 deletions
@@ -0,0 +1,19 @@
import { Processor, WorkerHost } from '@nestjs/bullmq';
import { Job } from 'bullmq';
import { TradeService } from '../modules/trade/trade.service';
import { DELIVERY_QUEUE } from './jobs.constants';
@Processor(DELIVERY_QUEUE)
export class DeliveryProcessor extends WorkerHost {
constructor(private readonly tradeService: TradeService) {
super();
}
async process(job: Job<{ orderId: string; targetStatus: string }>) {
await this.tradeService.applyStatusTransition(
BigInt(job.data.orderId),
'',
job.data.targetStatus,
);
}
}
@@ -0,0 +1 @@
export const DELIVERY_QUEUE = 'delivery-mock';
+11
View File
@@ -0,0 +1,11 @@
import { Module } from '@nestjs/common';
import { BullModule } from '@nestjs/bullmq';
import { TradeModule } from '../modules/trade/trade.module';
import { DeliveryProcessor } from './delivery.processor';
import { DELIVERY_QUEUE } from './jobs.constants';
@Module({
imports: [BullModule.registerQueue({ name: DELIVERY_QUEUE }), TradeModule],
providers: [DeliveryProcessor],
})
export class JobsModule {}