diff options
Diffstat (limited to 'app/graphql/mutations/custom_emoji')
-rw-r--r-- | app/graphql/mutations/custom_emoji/destroy.rb | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/app/graphql/mutations/custom_emoji/destroy.rb b/app/graphql/mutations/custom_emoji/destroy.rb new file mode 100644 index 00000000000..863b8152cc7 --- /dev/null +++ b/app/graphql/mutations/custom_emoji/destroy.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +module Mutations + module CustomEmoji + class Destroy < BaseMutation + graphql_name 'DestroyCustomEmoji' + + authorize :delete_custom_emoji + + field :custom_emoji, + Types::CustomEmojiType, + null: true, + description: 'Deleted custom emoji.' + + argument :id, ::Types::GlobalIDType[::CustomEmoji], + required: true, + description: 'Global ID of the custom emoji to destroy.' + + def resolve(id:) + custom_emoji = authorized_find!(id: id) + + custom_emoji.destroy! + + { + custom_emoji: custom_emoji + } + end + + private + + def find_object(id:) + GitlabSchema.object_from_id(id, expected_type: ::CustomEmoji) + end + end + end +end |