mirror of
https://github.com/nocobase/nocobase.git
synced 2026-09-24 16:02:20 +08:00
Merge branch 'main' into next
This commit is contained in:
@@ -113,21 +113,28 @@ class PluginCollectionTreeServer extends Plugin {
|
||||
throw new Error('Cannot set itself as the parent node');
|
||||
}
|
||||
});
|
||||
|
||||
this.db.on('collections.afterDestroy', async (collection: Model, { transaction }) => {
|
||||
const name = `main_${collection.get('name')}_path`;
|
||||
if (!condition(collection.options)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const collectionTree = this.db.getCollection(name);
|
||||
if (collectionTree) {
|
||||
await this.db.getCollection(name).removeFromDb({ transaction });
|
||||
|
||||
collectionManager.db.removeAllListeners(`${collection.name}.afterSync`);
|
||||
this.db.removeAllListeners(`${collection.name}.afterCreate`);
|
||||
this.db.removeAllListeners(`${collection.name}.afterUpdate`);
|
||||
this.db.removeAllListeners(`${collection.name}.afterBulkUpdate`);
|
||||
this.db.removeAllListeners(`${collection.name}.afterDestroy`);
|
||||
this.db.removeAllListeners(`${collection.name}.beforeSave`);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
this.db.on('collections.afterDestroy', async (collection: Model, { transaction }) => {
|
||||
const name = `main_${collection.get('name')}_path`;
|
||||
if (!condition(collection.options)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const collectionTree = this.db.getCollection(name);
|
||||
if (collectionTree) {
|
||||
await this.db.getCollection(name).removeFromDb({ transaction });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private async defineTreePathCollection(name: string, options: { schema?: string }) {
|
||||
|
||||
Reference in New Issue
Block a user