2022-02-21 10:19:50 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Resolvers
|
|
|
|
class WorkItemResolver < BaseResolver
|
|
|
|
include Gitlab::Graphql::Authorize::AuthorizeResource
|
|
|
|
|
2022-02-24 01:13:09 -05:00
|
|
|
authorize :read_work_item
|
2022-02-21 10:19:50 -05:00
|
|
|
|
|
|
|
type Types::WorkItemType, null: true
|
|
|
|
|
|
|
|
argument :id, ::Types::GlobalIDType[::WorkItem], required: true, description: 'Global ID of the work item.'
|
|
|
|
|
|
|
|
def resolve(id:)
|
|
|
|
work_item = authorized_find!(id: id)
|
2022-03-23 11:08:38 -04:00
|
|
|
return unless work_item.project.work_items_feature_flag_enabled?
|
2022-02-21 10:19:50 -05:00
|
|
|
|
|
|
|
work_item
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def find_object(id:)
|
|
|
|
GitlabSchema.find_by_gid(id)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|