debian-mirror-gitlab/app/graphql/mutations/award_emojis/add.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
471 B
Ruby
Raw Normal View History

2019-09-30 21:07:59 +05:30
# frozen_string_literal: true
module Mutations
module AwardEmojis
class Add < Base
2020-07-28 23:09:34 +05:30
graphql_name 'AwardEmojiAdd'
2019-09-30 21:07:59 +05:30
def resolve(args)
awardable = authorized_find!(id: args[:awardable_id])
2019-12-04 20:38:33 +05:30
service = ::AwardEmojis::AddService.new(awardable, args[:name], current_user).execute
2019-09-30 21:07:59 +05:30
{
2019-12-04 20:38:33 +05:30
award_emoji: (service[:award] if service[:status] == :success),
errors: service[:errors] || []
2019-09-30 21:07:59 +05:30
}
end
end
end
end