...
In the file src/modules/restaurant/restaurant.service.ts have a function called findEligible
and in these functions have another function deriveEligibility
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.
before:
...
after:
...
Just add nextOpenDate
in lines 174 and 175.
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 of eligible
equals the false:
before:
...
After this in :
...
In the file src/modules/quote/quote.service.ts in retrieveFirstQuote
function we can get these informations in the getEligibleDeliveryRestaurantData
function, because now return the errors and the nextOpenDate.
After this changes, we can validate if a restaurant has closed and create a new throw for closed restaurant QuoteRestaurantClosedError
with this we can to go for catch of retrieveFirstQuote
function.
And in this catch we can get the error of restaurant closed and the nextOpenDate.agora tratar o erro para retornar corretamente e mexer no frontmanipulate this error, and change for return the status correct and the nextOpenDate.
The return after this changes:
...
We made a POC for this in this link: https://github.com/rbilabs/intl-delivery-service/pull/470