mirror of
https://github.com/strapi/strapi.git
synced 2025-09-25 16:29:34 +00:00
remove delete components fix
This commit is contained in:
parent
c56ddfb253
commit
dad7237a44
@ -261,9 +261,8 @@ const createDefaultImplementation = ({ strapi, db, eventHub, entityValidator })
|
||||
return null;
|
||||
}
|
||||
|
||||
// Delete entity components first, and then the entity
|
||||
await deleteComponents(uid, entityToDelete);
|
||||
await db.query(uid).delete({ where: { id: entityToDelete.id } });
|
||||
await deleteComponents(uid, entityToDelete);
|
||||
|
||||
await this.emitEvent(uid, ENTRY_DELETE, entityToDelete);
|
||||
|
||||
@ -283,9 +282,8 @@ const createDefaultImplementation = ({ strapi, db, eventHub, entityValidator })
|
||||
return null;
|
||||
}
|
||||
|
||||
// Delete all the entities components first, and then the entities
|
||||
await Promise.all(entitiesToDelete.map(entity => deleteComponents(uid, entity)));
|
||||
const deletedEntities = await db.query(uid).deleteMany(query);
|
||||
await Promise.all(entitiesToDelete.map(entity => deleteComponents(uid, entity)));
|
||||
|
||||
// Trigger webhooks. One for each entity
|
||||
await Promise.all(entitiesToDelete.map(entity => this.emitEvent(uid, ENTRY_DELETE, entity)));
|
||||
|
@ -161,15 +161,6 @@ describe('Core API - Basic + compo + draftAndPublish', () => {
|
||||
data.productsWithCompoAndDP.shift();
|
||||
});
|
||||
|
||||
describe('database state', () => {
|
||||
test('components have been removed from the database', async () => {
|
||||
const dbComponents = await strapi.db
|
||||
.query('default.compo')
|
||||
.findMany({ name: 'compo name updated' });
|
||||
expect(dbComponents).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('validation', () => {
|
||||
test('Cannot create product with compo - compo required', async () => {
|
||||
const product = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user