...
Response of success is a big data, for this response we need to call the query with result valid and between hours work valid.
P.S. this doesn’t return the additional time:
Expand | |||||
---|---|---|---|---|---|
| |||||
|
...
In the file src/modules/quote/quote.service.ts. We have the retrieveFirstQuote function, and in this function it to do some validations and query for get restaurant.
...
In Called getEligibleDeliveryRestaurantData function and in this function get the restaurants validate for use.
...
After in this function the code have other called, the getWinningQuote:
...
And this Function call other function getQuotes, and this function return correct errors, inform that restaurant has errors, and the error is “The restaurant is closed”.
...
But after this the code, ignore this error and give an error forced, in return in case errors in retrieveFirstQuote is:
...
Because these are the errors ever are same thing, not has a treatment for the other flows.
Other problem that occur is the additional time for delivery, and the back-end does not return this information, just the normal time, so we need to add this as well.
Technical Solution
Here is an illustration that resume what we need to implement to adjust this.
...
intl-delivery-service
The code solution proposed here isn’t a final solution, is only a idea for the new flow!!!!!
Task 1 - create a feature flag
...
And the returned this function need to change too, because need pass the parameter
nextOpenDate
and adjusted of logic to return the data in case ofeligible
equals the false, in this validation we can validate if not have none eligible, so we use ineligible.ATTENTION - we use ineligible restaurant just in case don’t have restaurant open
Before:
...
After: this is just an example for works anything restaurant, this is NOT a final solution
...
Just an example to fire throw: ATTENTION this is an example, is not a final solution, because we need to validate if we have restaurant validated too, in case have one restaurant validate we don’t fire an exception
...
We have a problem for return the additional hours of delivery mode, currently the back-end don’t return this, the repository intl-delivery-service use the intl-packages of restaurant packages, in the file packages/restaurant/src/rbi-restaurant/operating-hours.ts have the formatOperatingHours
function, and in this function have just normal hours, so we need to add additional hours in this function.
Before:
...
After:
...
I can’t validate this function in develop environment, and this is just an example for the solution.Remember to create a new scenario in unit tests.
...
After add all new fields, we need to run the command “yarn graphql:types” to generate the types for GraphQL.
...