You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I would like to discuss the ability to change the final result of the crud via resolve.
The example below is simple, but the query I am trying to solve is composed of 10 nested object types and multiple computed fields. I also don't want to provide the user with these filters, I need to apply them to filter out, parts that don't make sense, or even should not be seen by him!
exportconstClientOffer=objectType({name: 'ClientOffer',definition(t){constmodel=t.model('Offer');model.offerID();model.title();model.carriersOfOffer({pagination: false,});},});exportextendType({type: 'Query',definition(t){t.crud.offer({alias: 'clientOffer',type: 'ClientOffer',asyncresolve(root,args,ctx,info,originalResolve){constresolved=awaitoriginalResolve(root,args,ctx,info);// This won't work, since `carriersOfOffer` will be undefined. It is part of other `objectType`constreplacementCategoryID=4;resolve.carriersOfOffer.filter(carreir=>{returncarrier.periods.some(period=>{returnperiod.selected||period.groups.some(group=>group.categoryID==replacementCategoryID);});});returnresolved;},});},});
Above is a very simple example of data, that needs to be filtered, it is part of business logic, no need to send client data that he will never see.
In my actual code, I need to filter multiple properties, that are nested on multiple different levels.
I would like to propose a solution that I have in mind to solve this. A method that can manipulate data after it has been processed from DB.
Hi, I would like to discuss the ability to change the final result of the crud via
resolve
.The example below is simple, but the query I am trying to solve is composed of 10 nested object types and multiple computed fields. I also don't want to provide the user with these filters, I need to apply them to filter out, parts that don't make sense, or even should not be seen by him!
Above is a very simple example of data, that needs to be filtered, it is part of business logic, no need to send client data that he will never see.
In my actual code, I need to filter multiple properties, that are nested on multiple different levels.
I would like to propose a solution that I have in mind to solve this. A method that can manipulate data after it has been processed from DB.
The text was updated successfully, but these errors were encountered: