Browse Source

fix(nocodb): remove ignoreFilterSort condition for applyPaginate and rename to ignoreViewFilterAndSort

pull/4435/head
Wing-Kam Wong 2 years ago
parent
commit
c91c0edefe
  1. 21
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts

21
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<any> {
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<any> {
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<XcFilter>
): 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({

Loading…
Cancel
Save