Expose `user` and `createdAt` in GraphQL `VersionType`
What does this MR do?
Expose user and createdAt in GraphQL VersionType
The GraphQL user
field calls #lazy_user
which loads the user
record using the new User.lazy_find
method.
.lazy_find
has been written as a Concern
in order for more models
to use this.
Using BatchLoader
to load associations in GraphQL avoids the normal
n+1 problems.
This can be useful in GraphQL for all belongs_to
.
This would normally execute a User
SQL query per Version
that was
returned:
module Types
class VersionType < BaseObject
field :user, Types::UserType ...
end
end
But a
module Types
class VersionType < BaseObject
field :user, Types::UserType ...
def user
# Batchloading logic
end
end
end
Executes just 1 (I'm guessing 1 among siblings in the AST).
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation created/updated or follow-up review issue created -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Performance and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Closes #13426 (closed)
Edited by 🤖 GitLab Bot 🤖