martmull 2024-06-12 16:25:04 +02:00 committed by GitHub
parent ad6547948b
commit 30d3ebc68a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 22 additions and 2 deletions

View File

@ -41,6 +41,7 @@ export class FindManyQueryFactory {
startCursor
endCursor
}
totalCount
}
}
`;

View File

@ -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') {

View File

@ -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',

View File

@ -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',

View File

@ -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',
},
},
},
},