mirror of
https://github.com/twentyhq/twenty.git
synced 2024-09-11 15:35:36 +03:00
Fix missing cursor on rest api (#5841)
## Before ![image](https://github.com/twentyhq/twenty/assets/29927851/fc3bad2d-5238-4afa-b528-409fbff3902c) ## After ![image](https://github.com/twentyhq/twenty/assets/29927851/418174c1-aafb-4ea2-a936-50c03ea17764) ![image](https://github.com/twentyhq/twenty/assets/29927851/03439033-db6b-44b0-9613-f766babc1d2d) ![image](https://github.com/twentyhq/twenty/assets/29927851/f0e5e998-3c61-437d-863f-7289609d0d30)
This commit is contained in:
parent
ad6547948b
commit
30d3ebc68a
@ -41,6 +41,7 @@ export class FindManyQueryFactory {
|
||||
startCursor
|
||||
endCursor
|
||||
}
|
||||
totalCount
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
@ -11,6 +11,12 @@ export const cleanGraphQLResponse = (input: any) => {
|
||||
output[key] = input[key].edges.map((edge) =>
|
||||
cleanGraphQLResponse(edge.node),
|
||||
);
|
||||
if (input[key].pageInfo) {
|
||||
output['pageInfo'] = input[key].pageInfo;
|
||||
}
|
||||
if (input[key].totalCount) {
|
||||
output['totalCount'] = input[key].totalCount;
|
||||
}
|
||||
} else if (isObject(input[key])) {
|
||||
output[key] = cleanGraphQLResponse(input[key]);
|
||||
} else if (key !== '__typename') {
|
||||
|
@ -111,7 +111,8 @@ describe('computeParameters', () => {
|
||||
expect(computeLastCursorParameters()).toEqual({
|
||||
name: 'last_cursor',
|
||||
in: 'query',
|
||||
description: 'Returns objects starting from a specific cursor.',
|
||||
description:
|
||||
'Returns objects starting from a specific cursor. You can find cursors in **startCursor** and **endCursor** in **pageInfo** in response data',
|
||||
required: false,
|
||||
schema: {
|
||||
type: 'string',
|
||||
|
@ -99,7 +99,8 @@ export const computeLastCursorParameters = (): OpenAPIV3_1.ParameterObject => {
|
||||
return {
|
||||
name: 'last_cursor',
|
||||
in: 'query',
|
||||
description: 'Returns objects starting from a specific cursor.',
|
||||
description:
|
||||
'Returns objects starting from a specific cursor. You can find cursors in **startCursor** and **endCursor** in **pageInfo** in response data',
|
||||
required: false,
|
||||
schema: {
|
||||
type: 'string',
|
||||
|
@ -22,6 +22,17 @@ export const getFindManyResponse200 = (
|
||||
)} with Relations`,
|
||||
},
|
||||
},
|
||||
pageInfo: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
hasNextPage: { type: 'boolean' },
|
||||
startCursor: { type: 'string' },
|
||||
endCursor: { type: 'string' },
|
||||
},
|
||||
},
|
||||
totalCount: {
|
||||
type: 'integer',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user