Browse Source

fix: avoid fractional page value

pull/7400/head
Pranav C 10 months ago
parent
commit
c2e1627a7f
  1. 7
      packages/nocodb/src/helpers/PagedResponse.ts
  2. 5
      packages/nocodb/src/schema/swagger.json

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

@ -28,8 +28,13 @@ export class PagedResponseImpl<T> {
this.pageInfo.isFirstPage =
this.pageInfo.isFirstPage ?? this.pageInfo.page === 1;
this.pageInfo.isLastPage =
this.pageInfo.page ===
this.pageInfo.page >=
(Math.ceil(this.pageInfo.totalRows / this.pageInfo.pageSize) || 1);
if (this.pageInfo.page % 1 !== 0) {
this.pageInfo.offset = offset;
delete this.pageInfo.page;
}
}
if (additionalProps) Object.assign(this, additionalProps);

5
packages/nocodb/src/schema/swagger.json

@ -20645,6 +20645,11 @@
"example": 1,
"type": "number"
},
"offset": {
"description": "The current offset and it will be present only when the page is not included",
"example": 1,
"type": "number"
},
"pageSize": {
"description": "The number of pages",
"example": 10,

Loading…
Cancel
Save