Class: Types::QueryType

Inherits:
BaseObject
  • Object
show all
Defined in:
app/graphql/types/query_type.rb

Defined Under Namespace

Classes: DesignManagementObject

Instance Method Summary collapse

Methods inherited from BaseObject

accepts, assignable?, authorization, authorization_scopes, authorize, authorized?, #id

Methods included from Gitlab::Graphql::Present

#present, #unpresented

Instance Method Details

#application_settingsObject



285
286
287
# File 'app/graphql/types/query_type.rb', line 285

def application_settings
  Gitlab::CurrentSettings.current_application_settings
end

#ci_application_settingsObject



281
282
283
# File 'app/graphql/types/query_type.rb', line 281

def ci_application_settings
  application_settings
end

#ci_pipeline_stage(id:) ⇒ Object



297
298
299
300
301
302
303
304
# File 'app/graphql/types/query_type.rb', line 297

def ci_pipeline_stage(id:)
  stage = ::Gitlab::Graphql::Lazy.force(GitlabSchema.find_by_gid(id))
  authorized = Ability.allowed?(current_user, :read_build, stage.project)

  return unless authorized

  stage
end

#container_repository(id:) ⇒ Object



273
274
275
# File 'app/graphql/types/query_type.rb', line 273

def container_repository(id:)
  GitlabSchema.find_by_gid(id)
end

#current_userObject



277
278
279
# File 'app/graphql/types/query_type.rb', line 277

def current_user
  context[:current_user]
end

#design_managementObject



252
253
254
# File 'app/graphql/types/query_type.rb', line 252

def design_management
  DesignManagementObject.new(nil)
end

#gitpod_enabledObject



289
290
291
# File 'app/graphql/types/query_type.rb', line 289

def gitpod_enabled
  application_settings.gitpod_enabled
end

#issue(id:) ⇒ Object



256
257
258
# File 'app/graphql/types/query_type.rb', line 256

def issue(id:)
  GitlabSchema.find_by_gid(id)
end

#job_token_policies_by_categoryObject



306
307
308
# File 'app/graphql/types/query_type.rb', line 306

def job_token_policies_by_category
  ::Ci::JobToken::Policies::POLICIES_BY_CATEGORY
end

#merge_request(id:) ⇒ Object



264
265
266
# File 'app/graphql/types/query_type.rb', line 264

def merge_request(id:)
  GitlabSchema.find_by_gid(id)
end

#milestone(id:, lookahead:) ⇒ Object



268
269
270
271
# File 'app/graphql/types/query_type.rb', line 268

def milestone(id:, lookahead:)
  preloads = [:releases] if lookahead.selects?(:releases)
  Gitlab::Graphql::Loaders::BatchModelLoader.new(id.model_class, id.model_id, preloads).find
end

#note(id:) ⇒ Object



260
261
262
# File 'app/graphql/types/query_type.rb', line 260

def note(id:)
  GitlabSchema.find_by_gid(id)
end

#query_complexityObject



293
294
295
# File 'app/graphql/types/query_type.rb', line 293

def query_complexity
  context.query
end