debian-mirror-gitlab/app/graphql/types/resolvable_interface.rb

29 lines
969 B
Ruby
Raw Normal View History

2020-06-23 00:09:42 +05:30
# frozen_string_literal: true
module Types
# This Interface contains fields that are shared between objects that include either
# the `ResolvableNote` or `ResolvableDiscussion` modules.
module ResolvableInterface
include Types::BaseInterface
field :resolved_by, Types::UserType,
null: true,
2021-03-11 19:13:27 +05:30
description: 'User who resolved the object.'
2020-06-23 00:09:42 +05:30
def resolved_by
return unless object.resolved_by_id
Gitlab::Graphql::Loaders::BatchModelLoader.new(User, object.resolved_by_id).find
end
field :resolved, GraphQL::BOOLEAN_TYPE, null: false,
2021-03-11 19:13:27 +05:30
description: 'Indicates if the object is resolved.',
2020-06-23 00:09:42 +05:30
method: :resolved?
field :resolvable, GraphQL::BOOLEAN_TYPE, null: false,
2021-03-11 19:13:27 +05:30
description: 'Indicates if the object can be resolved.',
2020-06-23 00:09:42 +05:30
method: :resolvable?
field :resolved_at, Types::TimeType, null: true,
2021-03-11 19:13:27 +05:30
description: 'Timestamp of when the object was resolved.'
2020-06-23 00:09:42 +05:30
end
end