From af5746bb39054bb1c75b5dacf2238efc245aa239 Mon Sep 17 00:00:00 2001 From: Davidson Gomes Date: Wed, 26 Jul 2023 17:45:28 -0300 Subject: [PATCH 1/4] Revert "GroupJid por Query ou por Body" --- src/whatsapp/abstract/abstract.router.ts | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/whatsapp/abstract/abstract.router.ts b/src/whatsapp/abstract/abstract.router.ts index d18cf36d..3c19e6bb 100644 --- a/src/whatsapp/abstract/abstract.router.ts +++ b/src/whatsapp/abstract/abstract.router.ts @@ -101,24 +101,18 @@ export abstract class RouterBroker { public async groupValidate(args: DataValidate) { const { request, ClassRef, schema, execute } = args; + const groupJid = request.query as unknown as GroupJid; + + if (!groupJid?.groupJid) { + throw new BadRequestException('The group id needs to be informed in the query', 'ex: "groupJid=120362@g.us"'); + } + const instance = request.params as unknown as InstanceDto; const body = request.body; - if (!body?.groupJid) { - if (request.query.groupJid) { - Object.assign(body, { - groupJid: request.query.groupJid - }); - } else { - throw new BadRequestException( - 'The group id needs to be informed in the query', - 'ex: "groupJid=120362@g.us"', - ); - } - } - const ref = new ClassRef(); + Object.assign(body, groupJid); Object.assign(ref, body); const v = validate(ref, schema); From 457dbe583198f34c4da7d423bd1abe9c0bc27ea9 Mon Sep 17 00:00:00 2001 From: Davidson Gomes Date: Wed, 26 Jul 2023 17:46:45 -0300 Subject: [PATCH 2/4] version: 1.4.6 --- src/whatsapp/abstract/abstract.router.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/whatsapp/abstract/abstract.router.ts b/src/whatsapp/abstract/abstract.router.ts index 3c19e6bb..bf1eee1b 100644 --- a/src/whatsapp/abstract/abstract.router.ts +++ b/src/whatsapp/abstract/abstract.router.ts @@ -101,18 +101,21 @@ export abstract class RouterBroker { public async groupValidate(args: DataValidate) { const { request, ClassRef, schema, execute } = args; - const groupJid = request.query as unknown as GroupJid; - - if (!groupJid?.groupJid) { - throw new BadRequestException('The group id needs to be informed in the query', 'ex: "groupJid=120362@g.us"'); - } - const instance = request.params as unknown as InstanceDto; const body = request.body; + if (!body?.groupJid) { + if (request.query.groupJid) { + Object.assign(body, { + groupJid: request.query.groupJid, + }); + } else { + throw new BadRequestException('The group id needs to be informed in the query', 'ex: "groupJid=120362@g.us"'); + } + } + const ref = new ClassRef(); - Object.assign(body, groupJid); Object.assign(ref, body); const v = validate(ref, schema); From 1bf2278f31a038ed8af36ee4647f16d401701274 Mon Sep 17 00:00:00 2001 From: Davidson Gomes Date: Wed, 26 Jul 2023 17:54:29 -0300 Subject: [PATCH 3/4] version: 1.4.6 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed0b7517..2a5235d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# 1.4.6 (homolog) +# 1.4.6 (2023-07-26 17:54) ### Fixed From 28a7d9c62b90eeac30143a03ac077e246478ba71 Mon Sep 17 00:00:00 2001 From: Davidson Gomes Date: Wed, 26 Jul 2023 18:02:45 -0300 Subject: [PATCH 4/4] fix: Adjusts in instance name --- src/whatsapp/controllers/instance.controller.ts | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/whatsapp/controllers/instance.controller.ts b/src/whatsapp/controllers/instance.controller.ts index e45644fe..64867a2d 100644 --- a/src/whatsapp/controllers/instance.controller.ts +++ b/src/whatsapp/controllers/instance.controller.ts @@ -55,19 +55,12 @@ export class InstanceController { try { this.logger.verbose('requested createInstance from ' + instanceName + ' instance'); - if (instanceName !== instanceName.toLowerCase().replace(/[^a-z0-9]/g, '')) { - throw new BadRequestException('The instance name must be lowercase and without special characters'); - } - this.logger.verbose('checking duplicate token'); await this.authService.checkDuplicateToken(token); this.logger.verbose('creating instance'); const instance = new WAStartupService(this.configService, this.eventEmitter, this.repository, this.cache); - instance.instanceName = instanceName - .toLowerCase() - .replace(/[^a-z0-9]/g, '') - .replace(' ', ''); + instance.instanceName = instanceName; this.logger.verbose('instance: ' + instance.instanceName + ' created');