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



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

def application_settings
  Gitlab::CurrentSettings.current_application_settings
end

#ci_application_settingsObject



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

def ci_application_settings
  application_settings
end

#ci_pipeline_stage(id:) ⇒ Object



328
329
330
331
332
333
334
335
336
337
# File 'app/graphql/types/query_type.rb', line 328

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



304
305
306
# File 'app/graphql/types/query_type.rb', line 304

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

#current_userObject



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

def current_user
  context[:current_user]
end

#design_managementObject



283
284
285
# File 'app/graphql/types/query_type.rb', line 283

def design_management
  DesignManagementObject.new(nil)
end

#gitpod_enabledObject



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

def gitpod_enabled
  application_settings.gitpod_enabled
end

#issue(id:) ⇒ Object



287
288
289
# File 'app/graphql/types/query_type.rb', line 287

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

#merge_request(id:) ⇒ Object



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

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

#milestone(id:, lookahead:) ⇒ Object



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

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



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

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

#query_complexityObject



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

def query_complexity
  context.query
end