From 914260ed7e0e818354afbb6d8a61d367d09e0aba Mon Sep 17 00:00:00 2001 From: ChengLei Shao Date: Tue, 4 Apr 2023 10:44:30 +0800 Subject: [PATCH] fix: update field error (#1645) --- .../src/relation-repository/hasmany-repository.ts | 8 +++++--- .../src/__tests__/collections.repository.test.ts | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/core/database/src/relation-repository/hasmany-repository.ts b/packages/core/database/src/relation-repository/hasmany-repository.ts index da721b59df..80c40ef9b6 100644 --- a/packages/core/database/src/relation-repository/hasmany-repository.ts +++ b/packages/core/database/src/relation-repository/hasmany-repository.ts @@ -43,12 +43,14 @@ export class HasManyRepository extends MultipleRelationRepository implements IHa addFilter[this.associationField.targetKey] = options.filterByTk; } - return await targetRepository.find({ - ...omit(options, ['filterByTk']), + const findOptions = { + ...omit(options, ['filterByTk', 'where', 'values', 'attributes']), filter: { $and: [options.filter || {}, addFilter], }, - }); + }; + + return await targetRepository.find(findOptions); } @transaction((args, transaction) => { diff --git a/packages/plugins/collection-manager/src/__tests__/collections.repository.test.ts b/packages/plugins/collection-manager/src/__tests__/collections.repository.test.ts index e48f8e108d..629e8e7183 100644 --- a/packages/plugins/collection-manager/src/__tests__/collections.repository.test.ts +++ b/packages/plugins/collection-manager/src/__tests__/collections.repository.test.ts @@ -673,6 +673,7 @@ describe('collections repository', () => { filterByTk: 'a', values: { key: C.key, + collectionName: 'c', uiSchema: { title: 'c-hello-world', },