diff --git a/src/controllers/CommandController.ts b/src/controllers/CommandController.ts index e4c6382c..8c2604b9 100644 --- a/src/controllers/CommandController.ts +++ b/src/controllers/CommandController.ts @@ -625,7 +625,13 @@ export class CommandController extends Controller { } const copy = new Command(); Object.assign(copy, { ...command, ...requestBody, id: undefined }); + const _null: any = null; copy.status = "NEW"; + copy.commandAffectDate = _null; + copy.commandExcecuteDate = _null; + copy.isSignature = _null; + copy.isDraft = _null; + copy.isSign = _null; copy.createdUserId = request.user.sub; copy.createdFullName = request.user.name; copy.createdAt = new Date(); @@ -634,59 +640,6 @@ export class CommandController extends Controller { copy.lastUpdatedAt = new Date(); await this.commandRepository.save(copy); - const commandRecives = await this.commandReciveRepository.find({ - where: { commandId: id }, - }); - const commandSends = await this.commandSendRepository.find({ - where: { commandId: id }, - relations: ["commandSendCCs"], - }); - commandRecives.map((x: any) => { - delete x.id; - return { - ...x, - commandId: copy.id, - createdUserId: request.user.sub, - createdFullName: request.user.name, - createdAt: new Date(), - lastUpdateUserId: request.user.sub, - lastUpdateFullName: request.user.name, - lastUpdatedAt: new Date(), - }; - }); - await this.commandReciveRepository.save(commandRecives); - - commandSends.map(async (x: any) => { - delete x.id; - let commandSend = { - ...x, - commandSendCCs: [], - commandId: copy.id, - createdUserId: request.user.sub, - createdFullName: request.user.name, - createdAt: new Date(), - lastUpdateUserId: request.user.sub, - lastUpdateFullName: request.user.name, - lastUpdatedAt: new Date(), - }; - await this.commandSendRepository.save(commandSend); - - let commandSendCC = await x.commandSendCCs.map((y: any) => { - delete y.id; - return { - ...y, - commandSendId: commandSend.id, - 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(commandSendCC); - }); - return new HttpSuccess(copy.id); }