fix: add validation to ensure order times fall within the specified slot boundaries
This commit is contained in:
parent
d42e240a2a
commit
d91cabaed0
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user