Skip to content

Workspaces API - order by schema fields instead of database fields#565

Merged
MarcelGeo merged 6 commits intodevelopfrom
api_to_db_fields_map
Jan 26, 2026
Merged

Workspaces API - order by schema fields instead of database fields#565
MarcelGeo merged 6 commits intodevelopfrom
api_to_db_fields_map

Conversation

@harminius
Copy link
Contributor

Fixes 1. and 3. in https://github.com/MerginMaps/server-private/issues/3154#issuecomment-3778290318

  • adds helper to map API field names to DB column names based on Schema
  • when invalid order param is passed error is thrown

@coveralls
Copy link

coveralls commented Jan 22, 2026

Pull Request Test Coverage Report for Build 21283805147

Details

  • 48 of 49 (97.96%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.04%) to 94.408%

Changes Missing Coverage Covered Lines Changed/Added Lines %
server/mergin/utils.py 22 23 95.65%
Totals Coverage Status
Change from base Build 21063718610: 0.04%
Covered Lines: 8137
Relevant Lines: 8619

💛 - Coveralls

@MarcelGeo MarcelGeo changed the title API to DB fields map Workspaces API - order by schema fields instead of database fields Jan 22, 2026
@harminius harminius requested a review from MarcelGeo January 22, 2026 14:11
- create schema map in controller for each request
- put back test for invalid order param with 200
- unit test for get_schema_fields_map helper
@harminius harminius requested a review from MarcelGeo January 23, 2026 11:01
@MarcelGeo MarcelGeo merged commit 48a66a6 into develop Jan 26, 2026
4 checks passed
@MarcelGeo MarcelGeo deleted the api_to_db_fields_map branch February 4, 2026 09:01
@RastoHu
Copy link

RastoHu commented Feb 4, 2026

Testing

@harminius, @MarcelGeo

  • are the "old" order_params still valid? For instance
    /v2/workspaces/<ws_id>/projects?page=1&per_page=10&order_params=disk_usage desc and
    /v2/workspaces/<ws_id>/projects?page=1&per_page=10&order_params=size desc returns the same response. In first url is order_param disk_usage (old) and in 2nd is size.
  • when invalid order param is passed error is thrown -> NOT FIXED:
    /v2/workspaces/17498/projects?page=1&per_page=10&order_params=somarina_jak_mraky asc returns valid response

@MarcelGeo
Copy link
Collaborator

Testing

@harminius, @MarcelGeo

* are the "old" order_params still valid? For instance
  /`v2/workspaces/<ws_id>/projects?page=1&per_page=10&order_params=disk_usage desc` and
  `/v2/workspaces/<ws_id>/projects?page=1&per_page=10&order_params=size desc` returns the same response. In first url is order_param **disk_usage** (old) and in 2nd is **size**.

* when invalid order param is passed error is thrown -> NOT FIXED:
  /`v2/workspaces/17498/projects?page=1&per_page=10&order_params=somarina_jak_mraky asc` returns valid response
  1. we can have both versions
  2. we are adding just logs but sorting is not working with somarina -> you just become some data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants