Add star count option to GQL ciCatalogResources endpoint
What does this MR do and why?
Adds the option to sort by star count when querying the ciCatalogResources
endpoint in GraphQl.
Resolves #432449 (closed).
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
How to set up and validate locally
- Seed 5 published catalog resources on your local gdk by executing the following. (Update the first parameter with an existing Group path.)
bundle exec rake "gitlab:seed:ci_catalog_resources[group-a, 5, true]"
- In the Rails console, assign a random star count value to each catalog resource project:
Ci::Catalog::Resource.all.each do |resource|
resource.project.update!(star_count: rand(100))
end
- In
http://gdk.test:3000/-/graphql-explorer
, test the following query.
query getSortedCatalogResources {
ciCatalogResources(sort: STAR_COUNT_ASC) {
nodes {
name
starCount
}
}
}
The result should show the resources in order of star count ascending.
- Update the
sort
parameter toSTAR_COUNT_DESC
. The result should show the resources in order of star count descending.
Related to #432449 (closed)
Edited by Leaminn Ma