Class: Types::QueryType

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

Defined Under Namespace

Classes: DesignManagementObject

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseObject

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

Methods included from Gitlab::Graphql::Present

#present, #unpresented

Class Method Details

.authorization_scopesObject



10
11
12
# File 'app/graphql/types/query_type.rb', line 10

def self.authorization_scopes
  super + [:ai_workflows]
end

Instance Method Details

#application_settingsObject



323
324
325
# File 'app/graphql/types/query_type.rb', line 323

def application_settings
  Gitlab::CurrentSettings.current_application_settings
end

#ci_application_settingsObject



319
320
321
# File 'app/graphql/types/query_type.rb', line 319

def ci_application_settings
  application_settings
end

#ci_pipeline_stage(id:) ⇒ Object



335
336
337
338
339
340
341
342
343
344
# File 'app/graphql/types/query_type.rb', line 335

def ci_pipeline_stage(id:)
  stage = ::Gitlab::Graphql::Lazy.force(GitlabSchema.find_by_gid(id))
  return unless stage

  authorized = Ability.allowed?(current_user, :read_build, stage.project)

  return unless authorized

  stage
end

#container_repository(id:) ⇒ Object



311
312
313
# File 'app/graphql/types/query_type.rb', line 311

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

#current_userObject



315
316
317
# File 'app/graphql/types/query_type.rb', line 315

def current_user
  context[:current_user]
end

#design_managementObject



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

def design_management
  DesignManagementObject.new(nil)
end

#gitpod_enabledObject



327
328
329
# File 'app/graphql/types/query_type.rb', line 327

def gitpod_enabled
  application_settings.gitpod_enabled
end

#issue(id:) ⇒ Object



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

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

#merge_request(id:) ⇒ Object



302
303
304
# File 'app/graphql/types/query_type.rb', line 302

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

#milestone(id:, lookahead:) ⇒ Object



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

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



298
299
300
# File 'app/graphql/types/query_type.rb', line 298

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

#query_complexityObject



331
332
333
# File 'app/graphql/types/query_type.rb', line 331

def query_complexity
  context.query
end