validate food by week day and meal type
This commit is contained in:
@@ -138,6 +138,16 @@ export class CartService {
|
||||
cart.description = description;
|
||||
}
|
||||
|
||||
// Final validation: if effective delivery method is courier, ensure all foods have pickupServe
|
||||
const effectiveDeliveryMethodId = deliveryMethodId ?? cart.deliveryMethodId;
|
||||
if (effectiveDeliveryMethodId) {
|
||||
const effectiveDeliveryMethod = await this.validationService.getDeliveryMethodForRestaurantOrFail(
|
||||
restaurantId,
|
||||
effectiveDeliveryMethodId,
|
||||
);
|
||||
await this.validationService.assertAllFoodsHavePickupServeForCourier(cart, effectiveDeliveryMethod.method);
|
||||
}
|
||||
|
||||
// Final recalculation + save and return cart
|
||||
return this.recalculateAndSaveCart(cart);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user