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:
parent
7a89cfa7ce
commit
63a68c6089
@ -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);
|
||||
// }
|
||||
// },
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user