customer_update.rb 808 B

1234567891011121314151617181920
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. module Gql::Mutations
  3. class Ticket::CustomerUpdate < BaseMutation
  4. description 'Update a ticket.'
  5. argument :ticket_id, GraphQL::Types::ID, loads: Gql::Types::TicketType, description: 'The ticket to be updated'
  6. argument :input, Gql::Types::Input::Ticket::CustomerUpdateInputType, description: 'The ticket update data'
  7. field :ticket, Gql::Types::TicketType, description: 'The updated ticket.'
  8. def self.authorize(_obj, ctx)
  9. ctx.current_user.permissions?('ticket.agent')
  10. end
  11. def resolve(ticket:, input:)
  12. { ticket: Service::Ticket::CustomerUpdate.new(current_user: context.current_user).execute(ticket: ticket, customer: input.customer, organization: input.organization) }
  13. end
  14. end
  15. end