delete.rb 657 B

1234567891011121314151617181920212223
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. module Gql::Mutations
  3. class Ticket::Checklist::Delete < BaseMutation
  4. description 'Delete a ticket checklist.'
  5. argument :checklist_id, GraphQL::Types::ID, required: true, loads: Gql::Types::ChecklistType, description: 'ID of the ticket checklist to delete.'
  6. field :success, Boolean, description: 'Was the mutation succcessful?'
  7. def resolve(checklist:)
  8. checklist.destroy!
  9. {
  10. success: true,
  11. }
  12. end
  13. def authorized?(checklist:, title: '')
  14. Pundit.authorize(context.current_user, checklist.ticket, :update?)
  15. end
  16. end
  17. end