feat: filter SMS routes by channel sensitive words
This commit is contained in:
@@ -872,10 +872,13 @@ export class SendChainService implements OnModuleInit, OnModuleDestroy {
|
||||
async recoverDrainageFailureReceipts() {
|
||||
const messages = await this.prisma.smsMessageRecord.findMany({
|
||||
where: {
|
||||
drainageReceiptPending: true,
|
||||
OR: [
|
||||
{ drainageReceiptPending: true, batchTask: { sourceType: 'cmpp' } },
|
||||
{ channelWordFinalizationPending: true },
|
||||
],
|
||||
status: { in: ['failed', 'submit_failed'] },
|
||||
batchTask: { sourceType: 'cmpp' },
|
||||
},
|
||||
include: { batchTask: { select: { sourceType: true } } },
|
||||
orderBy: { updatedAt: 'asc' },
|
||||
take: 50,
|
||||
});
|
||||
@@ -886,9 +889,21 @@ export class SendChainService implements OnModuleInit, OnModuleDestroy {
|
||||
{ ...message, tenantId: message.tenantId, batchTaskId: message.batchTaskId },
|
||||
reason,
|
||||
);
|
||||
if (message.channelWordFinalizationPending && message.batchTask?.sourceType !== 'cmpp') {
|
||||
await this.refreshTaskProgress(message.batchTaskId);
|
||||
await this.prisma.smsMessageRecord.update({
|
||||
where: { id: message.id },
|
||||
data: { channelWordFinalizationPending: false },
|
||||
});
|
||||
continue;
|
||||
}
|
||||
await this.recordCmppFailureReceipt(
|
||||
message,
|
||||
message.errorCode?.startsWith('DRN') ? message.errorCode : 'DRN',
|
||||
message.channelWordFinalizationPending
|
||||
? 'CSW'
|
||||
: message.errorCode?.startsWith('DRN')
|
||||
? message.errorCode
|
||||
: 'DRN',
|
||||
reason,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user