Draft: Add sorting options to member roles endpoint
What does this MR do and why?
Adds sorting options to member_roles API
How to set up and validate locally
- Create member roles
Group.find(<id>).member_roles.create!(base_access_level: 30)
- Make an authenticated API request to
https://gdk.test:3000/api/v4/groups/<id>/member_roles?order_by=id&sort=desc
and ensure that result is sorted
Query changes
Before https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/21508/commands/70030
SELECT "member_roles".* FROM "member_roles" WHERE "member_roles"."namespace_id" = 33
Time: 6.162 ms
- planning: 0.808 ms
- execution: 5.354 ms
- I/O read: 5.225 ms
- I/O write: 0.000 ms
Shared buffers:
- hits: 3 (~24.00 KiB) from the buffer pool
- reads: 1 (~8.00 KiB) from the OS file cache, including disk I/O
- dirtied: 0
- writes: 0
After https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/21508/commands/70031
SELECT "member_roles".* FROM "member_roles" WHERE "member_roles"."namespace_id" = 33 ORDER BY "member_roles"."created_at" DESC
Time: 0.337 ms
- planning: 0.214 ms
- execution: 0.123 ms
- I/O read: 0.000 ms
- I/O write: 0.000 ms
Shared buffers:
- hits: 7 (~56.00 KiB) from the buffer pool
- reads: 0 from the OS file cache, including disk I/O
- dirtied: 0
- writes: 0
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #417755 (closed)
Edited by Aboobacker MK