Welcome to mirror list, hosted at ThFree Co, Russian Federation.

add.rb « award_emojis « mutations « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 856fdd5fb14d3a117e42257ee6699afad4b24230 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

module Mutations
  module AwardEmojis
    class Add < Base
      graphql_name 'AwardEmojiAdd'

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

        check_object_is_awardable!(awardable)

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

        {
          award_emoji: (service[:award] if service[:status] == :success),
          errors: service[:errors] || []
        }
      end
    end
  end
end