Browse Source

fix: use limitOverride for export getDataList

pull/7823/head
mertmit 9 months ago
parent
commit
b0512625ec
  1. 12
      packages/nocodb/src/db/BaseModelSqlv2.ts
  2. 6
      packages/nocodb/src/modules/jobs/jobs/export-import/export.service.ts
  3. 2
      packages/nocodb/src/services/calendar-datas.service.ts
  4. 8
      packages/nocodb/src/services/datas.service.ts

12
packages/nocodb/src/db/BaseModelSqlv2.ts

@ -318,14 +318,14 @@ class BaseModelSqlv2 {
sortArr?: Sort[];
sort?: string | string[];
fieldsSet?: Set<string>;
calendarLimitOverride?: number;
limitOverride?: number;
} = {},
options: {
ignoreViewFilterAndSort?: boolean;
ignorePagination?: boolean;
validateFormula?: boolean;
throwErrorIfInvalidParams?: boolean;
calendarLimitOverride?: number;
limitOverride?: number;
} = {},
): Promise<any> {
const {
@ -333,7 +333,7 @@ class BaseModelSqlv2 {
ignorePagination = false,
validateFormula = false,
throwErrorIfInvalidParams = false,
calendarLimitOverride,
limitOverride,
} = options;
const { where, fields, ...rest } = this._getListArgs(args as any);
@ -439,12 +439,12 @@ class BaseModelSqlv2 {
});
}
// For calendar View, if calendarLimitOverride is provided, use it as limit for the query
// if limitOverride is provided, use it as limit for the query (for internal usage eg. calendar, export)
if (!ignorePagination) {
if (!calendarLimitOverride) {
if (!limitOverride) {
applyPaginate(qb, rest);
} else {
applyPaginate(qb, { ...rest, limit: calendarLimitOverride });
applyPaginate(qb, { ...rest, limit: limitOverride });
}
}
const proto = await this.getProto();

6
packages/nocodb/src/modules/jobs/jobs/export-import/export.service.ts

@ -611,6 +611,7 @@ export class ExportService {
query: { limit, offset, fields },
baseModel,
ignoreViewFilterAndSort: true,
limitOverride: limit,
})
.then((result) => {
try {
@ -661,6 +662,7 @@ export class ExportService {
query: { limit, offset, fields },
baseModel,
ignoreViewFilterAndSort: true,
limitOverride: limit,
})
.then((result) => {
try {
@ -681,7 +683,9 @@ export class ExportService {
offset + limit,
limit,
fields,
).then(resolve);
)
.then(resolve)
.catch(reject);
}
} catch (e) {
reject(e);

2
packages/nocodb/src/services/calendar-datas.service.ts

@ -56,7 +56,7 @@ export class CalendarDatasService {
viewName: view.id,
baseName: model.base_id,
tableName: model.id,
calendarLimitOverride: 3000, // TODO: make this configurable in env
limitOverride: 3000, // TODO: make this configurable in env
});
}

8
packages/nocodb/src/services/datas.service.ts

@ -23,7 +23,7 @@ export class DatasService {
query: any;
disableOptimization?: boolean;
ignorePagination?: boolean;
calendarLimitOverride?: number;
limitOverride?: number;
throwErrorIfInvalidParams?: boolean;
},
) {
@ -43,7 +43,7 @@ export class DatasService {
query: param.query,
throwErrorIfInvalidParams: true,
ignorePagination: param.ignorePagination,
calendarLimitOverride: param.calendarLimitOverride,
limitOverride: param.limitOverride,
});
}
@ -153,7 +153,7 @@ export class DatasService {
throwErrorIfInvalidParams?: boolean;
ignoreViewFilterAndSort?: boolean;
ignorePagination?: boolean;
calendarLimitOverride?: number;
limitOverride?: number;
}) {
const { model, view, query = {}, ignoreViewFilterAndSort = false } = param;
@ -193,7 +193,7 @@ export class DatasService {
ignoreViewFilterAndSort,
throwErrorIfInvalidParams: param.throwErrorIfInvalidParams,
ignorePagination: param.ignorePagination,
calendarLimitOverride: param.calendarLimitOverride,
limitOverride: param.limitOverride,
}),
{},
listArgs,

Loading…
Cancel
Save