From 63a68c6089a293efd2dd6d048de4ed6d52d42f05 Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Sat, 2 Aug 2025 19:26:38 +0300 Subject: [PATCH] refactor: comment out beforeDelete lifecycle method in slot API - Temporarily disabled the beforeDelete method to prevent slot deletion checks related to existing orders. This change is intended for further review and potential reimplementation. --- src/api/slot/content-types/slot/lifecycles.ts | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/api/slot/content-types/slot/lifecycles.ts b/src/api/slot/content-types/slot/lifecycles.ts index 27cad7e..aae12dd 100644 --- a/src/api/slot/content-types/slot/lifecycles.ts +++ b/src/api/slot/content-types/slot/lifecycles.ts @@ -130,15 +130,15 @@ export default { } } }, - async beforeDelete(event) { - const { where } = event.params; - const slotId = where.id; - const slot = await strapi.db.query('api::slot.slot').findOne({ - where: { id: slotId }, - populate: ['orders'], - }); - if (slot?.orders?.length) { - throw new Error(ERR_SLOT_HAS_ORDERS); - } - }, + // async beforeDelete(event) { + // const { where } = event.params; + // const slotId = where.id; + // const slot = await strapi.db.query('api::slot.slot').findOne({ + // where: { id: slotId }, + // populate: ['orders'], + // }); + // if (slot?.orders?.length) { + // throw new Error(ERR_SLOT_HAS_ORDERS); + // } + // }, };