TicketArticle.ts 1.0 KB

123456789101112131415161718192021222324252627282930
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import { faker } from '@faker-js/faker'
  3. import type { TicketArticle } from '#shared/graphql/types.ts'
  4. import { convertToGraphQLId } from '#shared/graphql/utils.ts'
  5. import type { DeepPartial } from '#shared/types/utils.ts'
  6. export default (): DeepPartial<TicketArticle> => {
  7. const senderNumber = faker.number.int({ min: 0, max: 2 })
  8. const body = faker.lorem.paragraph()
  9. return {
  10. contentType: faker.helpers.arrayElement(['text/html', 'text/plain']),
  11. body,
  12. bodyWithUrls: body,
  13. attachmentsWithoutInline: [],
  14. sender: {
  15. id: convertToGraphQLId('TicketArticleSender', senderNumber + 1),
  16. name: ['Agent', 'Customer', 'System'][senderNumber],
  17. },
  18. // possible types: db/seeds/ticket_article_types.rb
  19. // we only generate emails to have consistent articles
  20. type: {
  21. __typename: 'TicketArticleType',
  22. id: convertToGraphQLId('TicketArticleType', 1),
  23. name: 'email',
  24. communication: false,
  25. },
  26. }
  27. }