blob: 65065de0de43e0049ad23a92d7d087aae4e9eb2b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# frozen_string_literal: true
module Mutations
module AwardEmojis
class Base < BaseMutation
NOT_EMOJI_AWARDABLE = 'You cannot award emoji to this resource.'
authorize :award_emoji
argument :awardable_id,
::Types::GlobalIDType[::Awardable],
required: true,
description: 'Global ID of the awardable resource.'
argument :name,
GraphQL::Types::String,
required: true,
description: copy_field_description(Types::AwardEmojis::AwardEmojiType, :name)
field :award_emoji,
Types::AwardEmojis::AwardEmojiType,
null: true,
description: 'Award emoji after mutation.'
private
def authorize!(object)
super
raise_resource_not_available_error!(NOT_EMOJI_AWARDABLE) unless object.emoji_awardable?
end
end
end
end
|