init
This commit is contained in:
@@ -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,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user