File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed
Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -101,18 +101,24 @@ 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-
110104 const instance = request . params as unknown as InstanceDto ;
111105 const body = request . body ;
112106
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+
113120 const ref = new ClassRef ( ) ;
114121
115- Object . assign ( body , groupJid ) ;
116122 Object . assign ( ref , body ) ;
117123
118124 const v = validate ( ref , schema ) ;
You can’t perform that action at this time.
0 commit comments