Dedupe services methods in HttpApi
Hi. Is there a way to dedupe some methods from services for the current http request?
For example:
1) User makes a request for processing an order
2) The schema validates if the order exists (#1 query to get the order)
3) Controller makes sure the order belongs to the tenant (#2 query)
4) Other services fetch the order to process it (#3 query)
5) The real-time service fetches the order to notify the clients (#4 query)
And so on...
I know I can just pass the result as arguments but that will require to refactor a lot of code.
The idea is not to cache the order to be reuse in next requests, just dedupe all the "orderService.get" for the current request
For example:
1) User makes a request for processing an order
2) The schema validates if the order exists (#1 query to get the order)
3) Controller makes sure the order belongs to the tenant (#2 query)
4) Other services fetch the order to process it (#3 query)
5) The real-time service fetches the order to notify the clients (#4 query)
And so on...
I know I can just pass the result as arguments but that will require to refactor a lot of code.
The idea is not to cache the order to be reuse in next requests, just dedupe all the "orderService.get" for the current request
