diff --git a/src/api/order/content-types/order/lifecycles.ts b/src/api/order/content-types/order/lifecycles.ts index d30e04f..3a8a23d 100644 --- a/src/api/order/content-types/order/lifecycles.ts +++ b/src/api/order/content-types/order/lifecycles.ts @@ -39,6 +39,14 @@ export default { }); if (!slot) throw new Error(ERR_MISSING_SLOT); + // Проверка, что заказ укладывается в рамки слота + if ( + new Date(datetime_start) < new Date(slot.datetime_start) || + new Date(datetime_end) > new Date(slot.datetime_end) + ) { + throw new Error('Время заказа выходит за пределы слота'); + } + // 1. Слот не должен быть закрыт if (slot.state === 'closed') { throw new Error(ERR_SLOT_CLOSED);