diff --git a/src/api/order/content-types/order/lifecycles.ts b/src/api/order/content-types/order/lifecycles.ts index fadcb53..9f38cb7 100644 --- a/src/api/order/content-types/order/lifecycles.ts +++ b/src/api/order/content-types/order/lifecycles.ts @@ -64,6 +64,19 @@ export default { return; } + const existingOrder = await strapi.db.query('api::order.order').findOne({ + where: { id: entityId }, + select: ['documentId'], + populate: ['slot'], + }); + + if ( + existingOrder.time_start === time_start && + existingOrder.time_end === time_end + ) { + return; + } + if (!time_start || !time_end) { throw new Error(ERR_INVALID_TIME); } @@ -72,12 +85,6 @@ export default { throw new Error(ERR_INVALID_TIME); } - const existingOrder = await strapi.db.query('api::order.order').findOne({ - where: { id: entityId }, - select: ['documentId'], - populate: ['slot'], - }); - if (!existingOrder || !existingOrder.slot) { throw new Error('Существующий заказ или слот не найден'); }