list.rb 712 B

123456789101112131415161718192021222324
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. module Gql::Queries
  3. class Link::List < BaseQuery
  4. include Gql::Concerns::HandlesPossibleObjects
  5. description 'List linked objects'
  6. argument :object_id, GraphQL::Types::ID, required: true, description: 'Object ID'
  7. argument :target_type, String, required: true, description: 'Target type'
  8. type [Gql::Types::LinkType], null: true
  9. possible_objects ::Ticket, ::KnowledgeBase::Answer::Translation
  10. def resolve(object_id:, target_type:)
  11. object = fetch_object(object_id)
  12. Service::Link::List
  13. .new(current_user: context.current_user)
  14. .execute(object:, target_type:)
  15. end
  16. end
  17. end