history.rb 582 B

123456789101112131415161718192021
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. module Gql::Queries
  3. class Ticket::History < BaseQuery
  4. description 'Fetch history of a ticket'
  5. argument :ticket, Gql::Types::Input::Locator::TicketInputType, description: 'Ticket locator'
  6. type [Gql::Types::HistoryGroupType], null: false
  7. def self.authorize(_obj, ctx)
  8. ctx.current_user.permissions?(['ticket.agent'])
  9. end
  10. def resolve(ticket:)
  11. Service::History::Group
  12. .new(current_user: context.current_user)
  13. .execute(object: ticket)
  14. end
  15. end
  16. end