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

Adds support for encoded filters for API use #556

Merged
merged 8 commits into from
Feb 8, 2022
Merged

Conversation

atruskie
Copy link
Member

@atruskie atruskie commented Feb 4, 2022

Adds support for encoded filters for API use.

The API will now accept a filter encoded in base64url from either the query string or from body parameters.

This allows a simpler invocation of a filter endpoint via a GET request.

Fixes #555.

Changes

Adds support for decoding filters from the request parameter filter_encoded. A decoded filter is deep-merged into the hash of other request parameters.

Wiki also updated with new documentation: https://github.com/QutEcoacoustics/baw-server/wiki/API:-Filtering#advanced-filtering-with-a-query-string-parameter

Problems

Rails 7 and Ruby 3.1 upgrades bundled in. You can ignore those changes in your review (just review the last commit).

Visual Changes

N/A

Final Checklist

  • Assign reviewers if you have permission
  • Assign labels if you have permission
  • Link issues related to PR
  • Remove/Reduce warnings from edited files
  • Unit tests have been added for changes
  • Ensure CI build is passing

Our linter upgraded to Ruby 3.1 syntax automatically and started writing backwards-incompatible syntax changes into our files.

We needed fixes in the new linter so I decided to roll with the punches.
The API will now accept a filter encoded in base64url from either the querystring or from body parameters.

This allows a simpler invocation of a filter endpoint via a GET rquest.

Fixes #555
Copy link
Collaborator

@Allcharles Allcharles left a comment

Choose a reason for hiding this comment

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

Looks good, I much enjoy the smaller PRs. Makes it easier to track whats being done. Although I would have preferred this split into two separate PRs, however i suspect they were a package deal by the time you realised

app/modules/filter/query.rb Outdated Show resolved Hide resolved
spec/requests/cms_spec.rb Outdated Show resolved Hide resolved
atruskie and others added 5 commits February 4, 2022 21:23
Co-authored-by: Charles Alleman <charles@alleman.com.au>
Added a test case for complex characters and produced a better error message for a bad json payload.
Our PR was incorporated into arel_extensions. The monkey patch was no longer needed.
Most of the failures occurred due to the Rails 7 upgrade
@atruskie atruskie merged commit 9bff809 into master Feb 8, 2022
@atruskie atruskie deleted the encoded-filter branch February 8, 2022 04:10
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.

add filter QSP to API requests that accepts a base64 encoded filter payload
2 participants