title_update.rb 830 B

123456789101112131415161718192021222324
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. module Gql::Mutations
  3. class Ticket::Checklist::TitleUpdate < Ticket::Checklist::Base
  4. description 'Update title of the ticket checklist.'
  5. argument :checklist_id, GraphQL::Types::ID, required: true, loads: Gql::Types::ChecklistType, description: 'ID of the ticket checklist to update.'
  6. argument :title, String, required: false, description: 'New value for the ticket checklist title.'
  7. field :checklist, Gql::Types::ChecklistType, null: true, description: 'Created checklist'
  8. def authorized?(checklist:, title: '')
  9. Pundit.authorize(context.current_user, checklist, :update?)
  10. end
  11. def resolve(checklist:, title: '')
  12. checklist.update!(name: title)
  13. {
  14. checklist: checklist,
  15. }
  16. end
  17. end
  18. end