From c91c0edefe88344746d7638b75cd8a4569e585a6 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Sat, 19 Nov 2022 16:46:36 +0800 Subject: [PATCH] fix(nocodb): remove ignoreFilterSort condition for applyPaginate and rename to ignoreViewFilterAndSort --- .../sql-data-mapper/lib/sql/BaseModelSqlv2.ts | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts index 5c07bb1e2e..6b31c79d9b 100644 --- a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts +++ b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts @@ -175,7 +175,7 @@ class BaseModelSqlv2 { sortArr?: Sort[]; sort?: string | string[]; } = {}, - ignoreFilterSort = false + ignoreViewFilterAndSort = false ): Promise { const { where, ...rest } = this._getListArgs(args as any); @@ -189,7 +189,7 @@ class BaseModelSqlv2 { let sorts = extractSortsObject(rest?.sort, aliasColObjMap); const filterObj = extractFilterFromXwhere(where, aliasColObjMap); // todo: replace with view id - if (!ignoreFilterSort && this.viewId) { + if (!ignoreViewFilterAndSort && this.viewId) { await conditionV2( [ new Filter({ @@ -249,7 +249,7 @@ class BaseModelSqlv2 { qb.orderBy('created_at'); } - if (!ignoreFilterSort) applyPaginate(qb, rest); + applyPaginate(qb, rest); const proto = await this.getProto(); const data = await this.extractRawQueryAndExec(qb); @@ -261,7 +261,7 @@ class BaseModelSqlv2 { public async count( args: { where?: string; limit?; filterArr?: Filter[] } = {}, - ignoreFilterSort = false + ignoreViewFilterAndSort = false ): Promise { await this.model.getColumns(); const { where } = this._getListArgs(args); @@ -272,7 +272,7 @@ class BaseModelSqlv2 { const aliasColObjMap = await this.model.getAliasColObjMap(); const filterObj = extractFilterFromXwhere(where, aliasColObjMap); - if (!ignoreFilterSort && this.viewId) { + if (!ignoreViewFilterAndSort && this.viewId) { await conditionV2( [ new Filter({ @@ -2474,7 +2474,7 @@ class BaseModelSqlv2 { public async groupedList( args: { groupColumnId: string; - ignoreFilterSort?: boolean; + ignoreViewFilterAndSort?: boolean; options?: (string | number | null | boolean)[]; } & Partial ): Promise< @@ -2527,7 +2527,7 @@ class BaseModelSqlv2 { let sorts = extractSortsObject(args?.sort, aliasColObjMap); const filterObj = extractFilterFromXwhere(where, aliasColObjMap); // todo: replace with view id - if (!args.ignoreFilterSort && this.viewId) { + if (!args.ignoreViewFilterAndSort && this.viewId) { await conditionV2( [ new Filter({ @@ -2640,7 +2640,10 @@ class BaseModelSqlv2 { } public async groupedListCount( - args: { groupColumnId: string; ignoreFilterSort?: boolean } & XcFilter + args: { + groupColumnId: string; + ignoreViewFilterAndSort?: boolean; + } & XcFilter ) { const column = await this.model .getColumns() @@ -2659,7 +2662,7 @@ class BaseModelSqlv2 { const filterObj = extractFilterFromXwhere(args.where, aliasColObjMap); // todo: replace with view id - if (!args.ignoreFilterSort && this.viewId) { + if (!args.ignoreViewFilterAndSort && this.viewId) { await conditionV2( [ new Filter({