Fix quirky pagination and sorting behavior in /user/resources endpoint #676
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Change(s)
Change Type: Fixed
Change Category: Internal
Changelog Entry: Fixed quirky pagination and sorting behavior in
/user/resourcesendpoint.The
/user/resourcesendpoint previously had unintuitive behavior where it would paginate at theAIoDEntrylevel, then re-query individual asset tables (potentially reordering results), and finally re-sort in Python. This fix preserves the database sort order throughout the query process by creating anentry_ordermapping and applying it when fetching assets from individual tables, eliminating the need for Python-level re-sorting.How to Test
date_modifiedtimestamps/user/resourceswith pagination and sorting parameters:GET /user/resources?limit=5&sort=date_modified&direction=descGET /user/resources?limit=5&offset=5&sort=date_modified&direction=descdate_modifiedExisting tests in test_user_endpoints.py should pass (note: local Windows environment has unrelated test infrastructure issues with SQLite temp files, but CI/CD should pass).
Checklist
Related Issues
Closes #654