delete.rb 651 B

1234567891011121314151617181920212223
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. module Gql::Mutations
  3. class Ticket::Checklist::Delete < Ticket::Checklist::Base
  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 authorized?(checklist:)
  8. Pundit.authorize(context.current_user, checklist, :destroy?)
  9. end
  10. def resolve(checklist:)
  11. checklist.destroy!
  12. {
  13. success: true,
  14. }
  15. end
  16. end
  17. end