delete.rb 660 B

123456789101112131415161718192021
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. module Gql::Mutations
  3. class Ticket::SharedDraft::Zoom::Delete < BaseMutation
  4. description 'Deletes ticket shared draft'
  5. argument :shared_draft_id, GraphQL::Types::ID, loads: Gql::Types::Ticket::SharedDraftZoomType, description: 'The draft to be deleted'
  6. field :success, Boolean, null: false, description: 'Was the ticket article deletion successful?'
  7. def authorized?(shared_draft:)
  8. Pundit.authorize(context.current_user, shared_draft, :destroy?)
  9. end
  10. def resolve(shared_draft:)
  11. shared_draft.destroy!
  12. { success: true }
  13. end
  14. end
  15. end