Skip to content

Commit 8d73fb1

Browse files
Merge pull request #35 from EvolutionAPI/revert-34-groupJid-query-or-body
Revert "GroupJid por Query ou por Body"
2 parents 3f27d01 + af5746b commit 8d73fb1

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

src/whatsapp/abstract/abstract.router.ts

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -101,24 +101,18 @@ export abstract class RouterBroker {
101101
public async groupValidate<T>(args: DataValidate<T>) {
102102
const { request, ClassRef, schema, execute } = args;
103103

104+
const groupJid = request.query as unknown as GroupJid;
105+
106+
if (!groupJid?.groupJid) {
107+
throw new BadRequestException('The group id needs to be informed in the query', 'ex: "groupJid=120362@g.us"');
108+
}
109+
104110
const instance = request.params as unknown as InstanceDto;
105111
const body = request.body;
106112

107-
if (!body?.groupJid) {
108-
if (request.query.groupJid) {
109-
Object.assign(body, {
110-
groupJid: request.query.groupJid
111-
});
112-
} else {
113-
throw new BadRequestException(
114-
'The group id needs to be informed in the query',
115-
'ex: "groupJid=120362@g.us"',
116-
);
117-
}
118-
}
119-
120113
const ref = new ClassRef();
121114

115+
Object.assign(body, groupJid);
122116
Object.assign(ref, body);
123117

124118
const v = validate(ref, schema);

0 commit comments

Comments
 (0)