fix: use dataSource.collectionManager.getCollection

This commit is contained in:
chenos 2024-06-12 12:56:26 +08:00
parent 690b7cd636
commit 75f5098ded

View File

@ -7,9 +7,9 @@
* For more information, please refer to: https://www.nocobase.com/agreement.
*/
import { Context } from '@nocobase/actions';
import { assign, isValidFilter } from '@nocobase/utils';
import { pageArgsToLimitArgs } from './utils';
import { Context } from '@nocobase/actions';
function totalPage(total, pageSize): number {
return Math.ceil(total / pageSize);
@ -24,7 +24,7 @@ function findArgs(ctx: Context) {
params.tree = false;
} else {
const [collectionName, associationName] = resourceName.split('.');
const collection = ctx.db.getCollection(resourceName);
const collection = ctx.dataSource.collectionManager.getCollection(resourceName);
if (collection.options.tree && !(associationName && collectionName === collection.name)) {
const foreignKey = collection.treeParentField?.foreignKey || 'parentId';
assign(params, { filter: { [foreignKey]: null } }, { filter: 'andMerge' });