PageInfo.ts 528 B

12345678910111213141516
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import type { PageInfo } from '#shared/graphql/types.ts'
  3. import type { DeepPartial } from '#shared/types/utils.ts'
  4. export default (parent?: any): DeepPartial<PageInfo> => {
  5. const edgesLength = parent?.edges?.length ?? 0
  6. const last = parent.edges?.[edgesLength - 1]?.cursor ?? null
  7. const first = parent.edges?.[0]?.cursor ?? null
  8. return {
  9. endCursor: last,
  10. startCursor: first,
  11. hasNextPage: false,
  12. hasPreviousPage: false,
  13. }
  14. }