Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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.

beforeBefore:

...

afterAfter:

...

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, in this validation we can validate if not have none eligible, so we use ineligible.

Before:

...

After:

...

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.

Just an example to fire throw:

...

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.

...