debian-mirror-gitlab/app/graphql/types/award_emojis/award_emoji_type.rb

49 lines
1.2 KiB
Ruby
Raw Normal View History

2019-09-30 21:07:59 +05:30
# frozen_string_literal: true
module Types
module AwardEmojis
class AwardEmojiType < BaseObject
graphql_name 'AwardEmoji'
2020-11-24 15:15:51 +05:30
description 'An emoji awarded by a user'
2019-09-30 21:07:59 +05:30
authorize :read_emoji
present_using AwardEmojiPresenter
field :name,
2021-10-27 15:23:28 +05:30
GraphQL::Types::String,
2019-09-30 21:07:59 +05:30
null: false,
2021-03-11 19:13:27 +05:30
description: 'The emoji name.'
2019-09-30 21:07:59 +05:30
field :description,
2021-10-27 15:23:28 +05:30
GraphQL::Types::String,
2019-09-30 21:07:59 +05:30
null: false,
2021-03-11 19:13:27 +05:30
description: 'The emoji description.'
2019-09-30 21:07:59 +05:30
field :unicode,
2021-10-27 15:23:28 +05:30
GraphQL::Types::String,
2019-09-30 21:07:59 +05:30
null: false,
2021-03-11 19:13:27 +05:30
description: 'The emoji in Unicode.'
2019-09-30 21:07:59 +05:30
field :emoji,
2021-10-27 15:23:28 +05:30
GraphQL::Types::String,
2019-09-30 21:07:59 +05:30
null: false,
2021-03-11 19:13:27 +05:30
description: 'The emoji as an icon.'
2019-09-30 21:07:59 +05:30
field :unicode_version,
2021-10-27 15:23:28 +05:30
GraphQL::Types::String,
2019-09-30 21:07:59 +05:30
null: false,
2021-03-11 19:13:27 +05:30
description: 'The Unicode version for this emoji.'
2019-09-30 21:07:59 +05:30
field :user,
Types::UserType,
null: false,
2021-03-11 19:13:27 +05:30
description: 'The user who awarded the emoji.'
2021-02-22 17:27:13 +05:30
def user
Gitlab::Graphql::Loaders::BatchModelLoader.new(User, object.user_id).find
end
2019-09-30 21:07:59 +05:30
end
end
end