From e6d7d3a15407104311a30fd6871ca149a45bf4da Mon Sep 17 00:00:00 2001 From: ChengLei Shao Date: Tue, 24 Sep 2024 19:37:04 +0800 Subject: [PATCH] fix: scope key error (#5314) --- packages/core/database/src/database.ts | 4 ---- packages/core/database/src/fields/sort-field.ts | 1 + 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/core/database/src/database.ts b/packages/core/database/src/database.ts index a3b813b96b..6ef92765b6 100644 --- a/packages/core/database/src/database.ts +++ b/packages/core/database/src/database.ts @@ -460,10 +460,6 @@ export class Database extends EventEmitter implements AsyncEmitter { } if (options.underscored) { - if (lodash.get(options, 'sortable.scopeKey')) { - options.sortable.scopeKey = snakeCase(options.sortable.scopeKey); - } - if (lodash.get(options, 'indexes')) { // change index fields to snake case options.indexes = options.indexes.map((index) => { diff --git a/packages/core/database/src/fields/sort-field.ts b/packages/core/database/src/fields/sort-field.ts index da4a77fd3e..cbdf8ee5f8 100644 --- a/packages/core/database/src/fields/sort-field.ts +++ b/packages/core/database/src/fields/sort-field.ts @@ -171,6 +171,7 @@ export class SortField extends Field { }; const scopeKey = this.options.scopeKey; + if (scopeKey) { const groups = await this.collection.repository.find({ attributes: [scopeKey],