From e8504b1b0b3401b1627215ecfd1595a50e41ca67 Mon Sep 17 00:00:00 2001 From: Bright Date: Mon, 2 Dec 2024 11:15:49 +0700 Subject: [PATCH] default commandSend --- src/controllers/CommandController.ts | 36 +++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/src/controllers/CommandController.ts b/src/controllers/CommandController.ts index ae1d3241..4454e041 100644 --- a/src/controllers/CommandController.ts +++ b/src/controllers/CommandController.ts @@ -699,7 +699,7 @@ export class CommandController extends Controller { commandSend.lastUpdatedAt = new Date(); await this.commandSendRepository.save(commandSend); if(commandSend && commandSend.id) { - let _ccName = new Array("INBOX", "EMAIL"); + let _ccName = new Array("EMAIL", "INBOX"); let _dataSendCC = new Array(); for(let i=0; i<_ccName.length; i++) { _dataSendCC.push({ @@ -1808,6 +1808,23 @@ export class CommandController extends Controller { commandSend.lastUpdateFullName = request.user.name; commandSend.lastUpdatedAt = new Date(); await this.commandSendRepository.save(commandSend); + if(commandSend && commandSend.id) { + let _ccName = new Array("EMAIL", "INBOX"); + let _dataSendCC = new Array(); + for(let i=0; i<_ccName.length; i++) { + _dataSendCC.push({ + commandSendId: commandSend.id, + name: _ccName[i], + createdUserId: request.user.sub, + createdFullName: request.user.name, + createdAt: new Date(), + lastUpdateUserId: request.user.sub, + lastUpdateFullName: request.user.name, + lastUpdatedAt: new Date(), + }); + } + await this.commandSendCCRepository.save(_dataSendCC); + } }), ); @@ -1849,6 +1866,23 @@ export class CommandController extends Controller { commandSend.lastUpdateFullName = request.user.name; commandSend.lastUpdatedAt = new Date(); await this.commandSendRepository.save(commandSend); + if(commandSend && commandSend.id) { + let _ccName = new Array("EMAIL", "INBOX"); + let _dataSendCC = new Array(); + for(let i=0; i<_ccName.length; i++) { + _dataSendCC.push({ + commandSendId: commandSend.id, + name: _ccName[i], + createdUserId: request.user.sub, + createdFullName: request.user.name, + createdAt: new Date(), + lastUpdateUserId: request.user.sub, + lastUpdateFullName: request.user.name, + lastUpdatedAt: new Date(), + }); + } + await this.commandSendCCRepository.save(_dataSendCC); + } }), ); }