File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -98,22 +98,24 @@ export abstract class RouterBroker {
9898
9999 public async groupValidate < T > ( args : DataValidate < T > ) {
100100 const { request, ClassRef, schema, execute } = args ;
101-
102- const groupJid = request . query as unknown as GroupJid ;
103-
104- if ( ! groupJid ?. groupJid ) {
105- throw new BadRequestException (
106- 'The group id needs to be informed in the query' ,
107- 'ex: "groupJid=120362@g.us"' ,
108- ) ;
109- }
110-
111101 const instance = request . params as unknown as InstanceDto ;
112102 const body = request . body ;
113103
104+ if ( ! body ?. groupJid ) {
105+ if ( request . query . groupJid ) {
106+ Object . assign ( body , {
107+ groupJid : request . query . groupJid
108+ } ) ;
109+ } else {
110+ throw new BadRequestException (
111+ 'The group id needs to be informed in the query' ,
112+ 'ex: "groupJid=120362@g.us"' ,
113+ ) ;
114+ }
115+ }
116+
114117 const ref = new ClassRef ( ) ;
115118
116- Object . assign ( body , groupJid ) ;
117119 Object . assign ( ref , body ) ;
118120
119121 const v = validate ( ref , schema ) ;
You can’t perform that action at this time.
0 commit comments