public_links.rb 584 B

1234567891011121314151617181920
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. module Gql::Queries
  3. class PublicLinks < BaseQuery
  4. description 'Fetch public links'
  5. argument :screen, Gql::Types::Enum::PublicLinksScreenType, required: true, description: 'Fetch public links for a specific screen'
  6. type [Gql::Types::PublicLinkType], null: true
  7. # This query is available for all (including unauthenticated) users.
  8. def self.authorize(...)
  9. true
  10. end
  11. def resolve(screen:)
  12. PublicLink.select { |link| link[:screen].include?(screen) }
  13. end
  14. end
  15. end