ticket-overviews.ts 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import { TicketOverviewsDocument } from '#shared/entities/ticket/graphql/queries/ticket/overviews.api.ts'
  3. import type { TicketOverviewsQuery } from '#shared/graphql/types.ts'
  4. import { EnumOrderDirection } from '#shared/graphql/types.ts'
  5. import { TicketOverviewUpdatesDocument } from '#mobile/entities/ticket/graphql/subscriptions/ticketOverviewUpdates.api.ts'
  6. import { mockGraphQLApi, mockGraphQLSubscription } from '../mock-graphql-api.ts'
  7. export const getApiTicketOverviews = (): TicketOverviewsQuery => ({
  8. ticketOverviews: {
  9. pageInfo: {
  10. endCursor: null,
  11. hasNextPage: false,
  12. },
  13. edges: [
  14. {
  15. cursor: 'node1',
  16. node: {
  17. __typename: 'Overview',
  18. id: '1',
  19. name: __('Overview 1'),
  20. link: 'overview_1',
  21. ticketCount: 1,
  22. orderBy: 'created_at',
  23. orderDirection: EnumOrderDirection.Descending,
  24. prio: 100,
  25. active: true,
  26. viewColumns: [
  27. { key: 'number', value: 'Number' },
  28. { key: 'title', value: 'Title' },
  29. { key: 'created_at', value: 'Created at' },
  30. { key: 'updated_at', value: 'Updated at' },
  31. { key: 'priority', value: 'Priority' },
  32. ],
  33. orderColumns: [
  34. { key: 'number', value: 'Number' },
  35. { key: 'title', value: 'Title' },
  36. { key: 'created_at', value: 'Created at' },
  37. { key: 'updated_at', value: 'Updated at' },
  38. ],
  39. },
  40. },
  41. {
  42. cursor: 'node2',
  43. node: {
  44. __typename: 'Overview',
  45. id: '2',
  46. name: __('Overview 2'),
  47. link: 'overview_2',
  48. ticketCount: 2,
  49. orderBy: 'created_at',
  50. orderDirection: EnumOrderDirection.Ascending,
  51. prio: 200,
  52. active: true,
  53. viewColumns: [
  54. { key: 'number', value: 'Number' },
  55. { key: 'title', value: 'Title' },
  56. { key: 'created_at', value: 'Created at' },
  57. { key: 'updated_at', value: 'Updated at' },
  58. ],
  59. orderColumns: [
  60. { key: 'number', value: 'Number' },
  61. { key: 'title', value: 'Title' },
  62. { key: 'created_at', value: 'Created at' },
  63. { key: 'updated_at', value: 'Updated at' },
  64. ],
  65. },
  66. },
  67. {
  68. cursor: 'node3',
  69. node: {
  70. __typename: 'Overview',
  71. id: '3',
  72. name: __('Overview 3'),
  73. link: 'overview_3',
  74. ticketCount: 3,
  75. orderBy: 'created_at',
  76. orderDirection: EnumOrderDirection.Ascending,
  77. prio: 300,
  78. active: true,
  79. viewColumns: [
  80. { key: 'number', value: 'Number' },
  81. { key: 'title', value: 'Title' },
  82. { key: 'created_at', value: 'Created at' },
  83. { key: 'updated_at', value: 'Updated at' },
  84. ],
  85. orderColumns: [
  86. { key: 'number', value: 'Number' },
  87. { key: 'title', value: 'Title' },
  88. { key: 'created_at', value: 'Created at' },
  89. { key: 'updated_at', value: 'Updated at' },
  90. ],
  91. },
  92. },
  93. ],
  94. },
  95. })
  96. export const mockTicketOverviews = (overviews?: TicketOverviewsQuery) => {
  97. mockGraphQLSubscription(TicketOverviewUpdatesDocument)
  98. return mockGraphQLApi(TicketOverviewsDocument).willResolve(
  99. overviews || getApiTicketOverviews(),
  100. )
  101. }