From 457dbe583198f34c4da7d423bd1abe9c0bc27ea9 Mon Sep 17 00:00:00 2001 From: Davidson Gomes Date: Wed, 26 Jul 2023 17:46:45 -0300 Subject: [PATCH] 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);