mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-22 03:56:54 -06:00
Merge pull request #34 from moskoweb/groupJid-query-or-body
fix: GroupJid por Query ou por Body
This commit is contained in:
commit
3f27d018c7
@ -101,18 +101,24 @@ export abstract class RouterBroker {
|
|||||||
public async groupValidate<T>(args: DataValidate<T>) {
|
public async groupValidate<T>(args: DataValidate<T>) {
|
||||||
const { request, ClassRef, schema, execute } = args;
|
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 instance = request.params as unknown as InstanceDto;
|
||||||
const body = request.body;
|
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();
|
const ref = new ClassRef();
|
||||||
|
|
||||||
Object.assign(body, groupJid);
|
|
||||||
Object.assign(ref, body);
|
Object.assign(ref, body);
|
||||||
|
|
||||||
const v = validate(ref, schema);
|
const v = validate(ref, schema);
|
||||||
|
Loading…
Reference in New Issue
Block a user