Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orderby support in entity odata endpoint #1078

Merged
merged 6 commits into from Feb 2, 2024
Merged

Conversation

ktuite
Copy link
Member

@ktuite ktuite commented Jan 30, 2024

Closes #

Adds $orderby support to OData endpoints for Entities and Submissions. This will be useful overall but it is also part of Frontend showing existing entities in the bulk entity creation flow.

What has been done to verify that this works as intended?

Tests

Why is this the best possible solution? Were any other approaches considered?

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

New feature for users! We've covered a lot of the OData spec at this point!

Does this change require updates to the API documentation? If so, please update docs/api.md as part of this PR.

Documentation has been updated in this PR.

Before submitting this PR, please make sure you have:

  • run make test-full and confirmed all checks still pass OR confirm CircleCI build passes
  • verified that any code from external sources are properly credited in comments or that everything is internally sourced

@matthew-white
Copy link
Member

Is there a way to ensure that the sort is stable? Currently, the ORDER BY clause ends with entities.id DESC, and I think it'd be useful to continue doing that. Though with $orderby, maybe the DESC/ASC after entities.id should match the DESC/ASC that the user specifies for the first $orderby property. 🤔

@matthew-white
Copy link
Member

I'm going to add this PR to the project even though getodk/central#589 was the main impetus behind it. It's a nice improvement on its own that we'll want to mention in release notes.

Copy link
Member Author

@ktuite ktuite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

notes from interactive review with Matt

lib/data/odata-filter.js Outdated Show resolved Hide resolved
lib/data/odata-filter.js Outdated Show resolved Hide resolved
lib/data/odata-filter.js Show resolved Hide resolved
lib/data/odata-filter.js Outdated Show resolved Hide resolved
test/unit/data/odata-filter.js Outdated Show resolved Hide resolved
test/unit/http/endpoint.js Show resolved Hide resolved
test/unit/data/odata-filter.js Show resolved Hide resolved
lib/model/query/entities.js Show resolved Hide resolved
@ktuite ktuite marked this pull request as ready for review February 1, 2024 21:44
@ktuite ktuite merged commit 9c5f6b2 into master Feb 2, 2024
5 checks passed
@ktuite ktuite deleted the ktuite/reverse_sort branch February 2, 2024 21:00
@ktuite ktuite mentioned this pull request Feb 27, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants