2019-06-21 04:45:27 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Mutations
|
|
|
|
module AwardEmojis
|
|
|
|
class Remove < Base
|
2020-06-23 12:09:20 +00:00
|
|
|
graphql_name 'AwardEmojiRemove'
|
2019-06-21 04:45:27 +00:00
|
|
|
|
|
|
|
def resolve(args)
|
|
|
|
awardable = authorized_find!(id: args[:awardable_id])
|
|
|
|
|
|
|
|
check_object_is_awardable!(awardable)
|
|
|
|
|
2019-07-09 01:57:04 +00:00
|
|
|
service = ::AwardEmojis::DestroyService.new(awardable, args[:name], current_user).execute
|
2019-06-21 04:45:27 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
# Mutation response is always a `nil` award_emoji
|
2019-07-09 01:57:04 +00:00
|
|
|
errors: service[:errors] || []
|
2019-06-21 04:45:27 +00:00
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|