...
Create a flag DELIVERY-CLOSED-AT-MOMENT
Task 2 -
...
In the file packages/restaurant/src/rbi-restaurant/operating-hours.ts, we need to change the isRestaurantOpen
, getNextEarliestOpen
and getHoursOfOperationForDay
functions, because this function to validate is restaurants is open and day work, but just validate the hours work normal, but now we need to validate the additional hours work too.
Add unit test for this new scenarios too.
...
return nextOpenDate
in findEligible
function
In the file src/modules/restaurant/restaurant.service.ts have a function called
findEligible
and in these functions have another functionderiveEligibility
and in this function return errors of restaurant and return the next time that the restaurant open again, but now don’t use this, so we need to add this information.
...
After: this is just an example for works anything restaurant, this is NOT a final solution
...
Task
...
3 - Validate if restaurant is closed and fire a throw exception
In the file src/modules/quote/quote.service.ts in
retrieveFirstQuote
function, we can get these informations in thegetEligibleDeliveryRestaurantData
function, because now return the errors and the nextOpenDate.
...
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
...
Task
...
4 - Change of return in catch for return correct status
In the file src/modules/quote/quote.service.ts in
retrieveFirstQuote
function we can adjust the return in catch and in this catch we can get the error of restaurant closed and manipulate this error, and change for return the status correct and the nextOpenDate.Return the restaurantsData as well, because we need this information to check services modes and hours for working.
...
The return after this changes:
...
Task
...
5 - Validate and update Bump for project
Validate if we need to make something for update, bump this repository in whitelabel-graphql
...