ObjectManagerFrontendAttributesPayload.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import {
  3. EnumObjectManagerObjects,
  4. type ObjectManagerFrontendAttributesPayload,
  5. } from '#shared/graphql/types.ts'
  6. import organizationAttributes from './fixtures/organization-object-attributes.ts'
  7. import ticketAtricleAttributes from './fixtures/ticket-article-object-attributes.ts'
  8. import ticketAttributes from './fixtures/ticket-object-attributes.ts'
  9. import userAttributes from './fixtures/user-object-attributes.ts'
  10. import type { ResolversMeta } from '../builders/index.ts'
  11. const payloads: Record<
  12. EnumObjectManagerObjects,
  13. () => ObjectManagerFrontendAttributesPayload
  14. > = {
  15. [EnumObjectManagerObjects.Group]: () => ({ screens: [], attributes: [] }),
  16. [EnumObjectManagerObjects.User]: userAttributes,
  17. [EnumObjectManagerObjects.Organization]: organizationAttributes,
  18. [EnumObjectManagerObjects.Ticket]: ticketAttributes,
  19. [EnumObjectManagerObjects.TicketArticle]: ticketAtricleAttributes,
  20. }
  21. export default (
  22. _1: unknown,
  23. _2: unknown,
  24. meta: ResolversMeta,
  25. ): ObjectManagerFrontendAttributesPayload => {
  26. return payloads[meta.variables.object as EnumObjectManagerObjects]()
  27. }