Class: Mutations::AwardEmojis::Remove

Inherits:
Base
  • Object
show all
Defined in:
app/graphql/mutations/award_emojis/remove.rb

Constant Summary

Constants inherited from BaseMutation

BaseMutation::ERROR_MESSAGE

Instance Method Summary collapse

Methods inherited from BaseMutation

#api_user?, #current_user, #errors_on_object, #ready?

Instance Method Details

#resolve(args) ⇒ Object


8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/graphql/mutations/award_emojis/remove.rb', line 8

def resolve(args)
  awardable = authorized_find!(id: args[:awardable_id])

  check_object_is_awardable!(awardable)

  service = ::AwardEmojis::DestroyService.new(awardable, args[:name], current_user).execute

  {
    # Mutation response is always a `nil` award_emoji
    errors: service[:errors] || []
  }
end