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, authorize, authorized?, #id

Methods included from Gitlab::Graphql::Present

#present, #unpresented

Instance Method Details

#application_settingsObject



226
227
228
# File 'app/graphql/types/query_type.rb', line 226

def application_settings
  Gitlab::CurrentSettings.current_application_settings
end

#ci_application_settingsObject



222
223
224
# File 'app/graphql/types/query_type.rb', line 222

def ci_application_settings
  application_settings
end

#ci_pipeline_stage(id:) ⇒ Object



238
239
240
241
242
243
244
245
# File 'app/graphql/types/query_type.rb', line 238

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



214
215
216
# File 'app/graphql/types/query_type.rb', line 214

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

#current_userObject



218
219
220
# File 'app/graphql/types/query_type.rb', line 218

def current_user
  context[:current_user]
end

#design_managementObject



193
194
195
# File 'app/graphql/types/query_type.rb', line 193

def design_management
  DesignManagementObject.new(nil)
end

#gitpod_enabledObject



230
231
232
# File 'app/graphql/types/query_type.rb', line 230

def gitpod_enabled
  application_settings.gitpod_enabled
end

#issue(id:) ⇒ Object



197
198
199
# File 'app/graphql/types/query_type.rb', line 197

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

#merge_request(id:) ⇒ Object



205
206
207
# File 'app/graphql/types/query_type.rb', line 205

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

#milestone(id:, lookahead:) ⇒ Object



209
210
211
212
# File 'app/graphql/types/query_type.rb', line 209

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



201
202
203
# File 'app/graphql/types/query_type.rb', line 201

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

#query_complexityObject



234
235
236
# File 'app/graphql/types/query_type.rb', line 234

def query_complexity
  context.query
end