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[]; sortArr?: Sort[];
sort?: string | string[]; sort?: string | string[];
fieldsSet?: Set<string>; fieldsSet?: Set<string>;
calendarLimitOverride?: number; limitOverride?: number;
} = {}, } = {},
options: { options: {
ignoreViewFilterAndSort?: boolean; ignoreViewFilterAndSort?: boolean;
ignorePagination?: boolean; ignorePagination?: boolean;
validateFormula?: boolean; validateFormula?: boolean;
throwErrorIfInvalidParams?: boolean; throwErrorIfInvalidParams?: boolean;
calendarLimitOverride?: number; limitOverride?: number;
} = {}, } = {},
): Promise<any> { ): Promise<any> {
const { const {
@ -333,7 +333,7 @@ class BaseModelSqlv2 {
ignorePagination = false, ignorePagination = false,
validateFormula = false, validateFormula = false,
throwErrorIfInvalidParams = false, throwErrorIfInvalidParams = false,
calendarLimitOverride, limitOverride,
} = options; } = options;
const { where, fields, ...rest } = this._getListArgs(args as any); 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 (!ignorePagination) {
if (!calendarLimitOverride) { if (!limitOverride) {
applyPaginate(qb, rest); applyPaginate(qb, rest);
} else { } else {
applyPaginate(qb, { ...rest, limit: calendarLimitOverride }); applyPaginate(qb, { ...rest, limit: limitOverride });
} }
} }
const proto = await this.getProto(); 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 }, query: { limit, offset, fields },
baseModel, baseModel,
ignoreViewFilterAndSort: true, ignoreViewFilterAndSort: true,
limitOverride: limit,
}) })
.then((result) => { .then((result) => {
try { try {
@ -661,6 +662,7 @@ export class ExportService {
query: { limit, offset, fields }, query: { limit, offset, fields },
baseModel, baseModel,
ignoreViewFilterAndSort: true, ignoreViewFilterAndSort: true,
limitOverride: limit,
}) })
.then((result) => { .then((result) => {
try { try {
@ -681,7 +683,9 @@ export class ExportService {
offset + limit, offset + limit,
limit, limit,
fields, fields,
).then(resolve); )
.then(resolve)
.catch(reject);
} }
} catch (e) { } catch (e) {
reject(e); reject(e);

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

@ -56,7 +56,7 @@ export class CalendarDatasService {
viewName: view.id, viewName: view.id,
baseName: model.base_id, baseName: model.base_id,
tableName: model.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; query: any;
disableOptimization?: boolean; disableOptimization?: boolean;
ignorePagination?: boolean; ignorePagination?: boolean;
calendarLimitOverride?: number; limitOverride?: number;
throwErrorIfInvalidParams?: boolean; throwErrorIfInvalidParams?: boolean;
}, },
) { ) {
@ -43,7 +43,7 @@ export class DatasService {
query: param.query, query: param.query,
throwErrorIfInvalidParams: true, throwErrorIfInvalidParams: true,
ignorePagination: param.ignorePagination, ignorePagination: param.ignorePagination,
calendarLimitOverride: param.calendarLimitOverride, limitOverride: param.limitOverride,
}); });
} }
@ -153,7 +153,7 @@ export class DatasService {
throwErrorIfInvalidParams?: boolean; throwErrorIfInvalidParams?: boolean;
ignoreViewFilterAndSort?: boolean; ignoreViewFilterAndSort?: boolean;
ignorePagination?: boolean; ignorePagination?: boolean;
calendarLimitOverride?: number; limitOverride?: number;
}) { }) {
const { model, view, query = {}, ignoreViewFilterAndSort = false } = param; const { model, view, query = {}, ignoreViewFilterAndSort = false } = param;
@ -193,7 +193,7 @@ export class DatasService {
ignoreViewFilterAndSort, ignoreViewFilterAndSort,
throwErrorIfInvalidParams: param.throwErrorIfInvalidParams, throwErrorIfInvalidParams: param.throwErrorIfInvalidParams,
ignorePagination: param.ignorePagination, ignorePagination: param.ignorePagination,
calendarLimitOverride: param.calendarLimitOverride, limitOverride: param.limitOverride,
}), }),
{}, {},
listArgs, listArgs,

Loading…
Cancel
Save