validate food by week day and meal type

This commit is contained in:
2025-12-20 20:09:41 +03:30
parent 0815fd9780
commit 6318c5b8ab
3 changed files with 139 additions and 0 deletions
@@ -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);
}