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.
This commit is contained in:
vchikalkin 2025-08-02 19:26:38 +03:00
parent 7a89cfa7ce
commit 63a68c6089

View File

@ -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);
// }
// },
};