Support ordering in List*Collaborator requests
Summary
It would be nice if we could support custom ordering in List*Collaborator requests.
Current Situation
We support pagination, but ordering is always by account ID (I think)
Why do we need this? Who uses it, and when?
I remember @kschiffer mentioned that this would be nice to have because of consistency with other listings in the Console. Can't find the issue though.
Proposed Implementation
- Add field to
List*Collaboratorrequests in the API - Pass it to the IS store (using context)
- Support it in the IS store
Contributing
- [ ] I can help by doing more research.
- [ ] I can help by implementing the feature after the proposal above is approved.
- [ ] I can help by testing the feature before it's released.
Code of Conduct
- [X] I agree to follow TTN's Community Code of Conduct.
It would indeed be more consistent with other entities. I added a lot of sorting functionality via https://github.com/TheThingsNetwork/lorawan-stack/pull/5497 but had to implement a workaround for sorting collaborators in the frontend because the backend doesn't allow it.
Sorting for collaborators is now solved in the frontend using a limit of 1000 and disabling sorting if the total count is above that. It felt like an acceptable compromise to me after looking into the complexity of sorting in the backend that uses a composed join of orgs and users which makes sorting quite complicated (to me).
Writing here as I'm trying to keep the issues more updated instead writing everything on the Pull Requests, after making the initial necessary changes (can be found on this branch) I notice that the FindMembers method of the Membership interface returns a map and that implies that the sorted elements are returned in a random order.
The sort changes were made for both the gormstore and the bunstore, so currently what is missing on this is change in the membership interface to guarantee the consistency in the list provided by the database.
Changes the assignees due to the backend section of this being done. Tagged @kschiffer in hopes that he can best assign the issue to the appropriate person.