Browse Source

fix: apply limit override to PagedResponseImpl

pull/7823/head
mertmit 10 months ago
parent
commit
4de1087d90
  1. 1
      packages/nocodb/src/helpers/PagedResponse.ts
  2. 6
      packages/nocodb/src/helpers/extractLimitAndOffset.ts
  3. 1
      packages/nocodb/src/services/datas.service.ts

1
packages/nocodb/src/helpers/PagedResponse.ts

@ -11,6 +11,7 @@ export class PagedResponseImpl<T> {
count?: number | string;
l?: number;
o?: number;
limitOverride?: number;
} = {},
additionalProps?: Record<string, any>,
) {

6
packages/nocodb/src/helpers/extractLimitAndOffset.ts

@ -15,6 +15,7 @@ export function extractLimitAndOffset(
offset?: number | string;
l?: number | string;
o?: number | string;
limitOverride?: number;
} = {},
) {
const obj: {
@ -40,5 +41,10 @@ export function extractLimitAndOffset(
const offset = +(args.offset || args.o) || 0;
obj.offset = Math.max(Number.isInteger(offset) ? offset : 0, 0);
// override limit if provided
if (args.limitOverride) {
obj.limit = +args.limitOverride;
}
return obj;
}

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

@ -210,6 +210,7 @@ export class DatasService {
]);
return new PagedResponseImpl(data, {
...query,
...(param.limitOverride ? { limitOverride: param.limitOverride } : {}),
count,
});
}

Loading…
Cancel
Save