2019-09-30 21:07:59 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Mutations
|
|
|
|
module AwardEmojis
|
|
|
|
class Remove < Base
|
|
|
|
graphql_name 'RemoveAwardEmoji'
|
|
|
|
|
|
|
|
def resolve(args)
|
|
|
|
awardable = authorized_find!(id: args[:awardable_id])
|
|
|
|
|
|
|
|
check_object_is_awardable!(awardable)
|
|
|
|
|
2019-12-04 20:38:33 +05:30
|
|
|
service = ::AwardEmojis::DestroyService.new(awardable, args[:name], current_user).execute
|
2019-09-30 21:07:59 +05:30
|
|
|
|
|
|
|
{
|
|
|
|
# Mutation response is always a `nil` award_emoji
|
2019-12-04 20:38:33 +05:30
|
|
|
errors: service[:errors] || []
|
2019-09-30 21:07:59 +05:30
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|