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

Update Submissions OData to include deletedAt #1231

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

sadiqkhoja
Copy link
Contributor

@sadiqkhoja sadiqkhoja commented Oct 21, 2024

Part of getodk/central#709

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

  • Added unit and integration tests.
  • Manually verified with the frontend.
  • Checked with Excel to ensure there's no regression.

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

I have added __system/deletedAt field in the OData response and made it filterable. If client’s $filter expression doesn’t contain __system/deletedAt related clause then default __system/deletedAt eq null is added.

This approach keeps our Odata API consistent with respect to other system fields and quite useful for clients who are interested in filtering Submissions by deletedAt column. Maybe in future we also want to add this on the frontend.

Other option was to add a special filterable boolean field __system/deleted, which is simple but doesn't come with the benefits mentioned above.

OData spec doesn’t have anything explicit mechanism to track deleted records. There is a concept of deltaLink that returns list of new/changed/deleted records since last request. That concept is not related to what are looking for here.


I have added a new function odataExcludeDeleted that analyzes $filter expression for the existence of __system/deletedAt related clause. Initially, I had modified odataFilter function with the same logic but that made it convoluted, hence I refactored it into a separate function for the sake of simplicity at the cost of parsing $filter expression twice.

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?

None.

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

Done.

Before submitting this PR, please make sure you have:

  • run make test 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

@sadiqkhoja sadiqkhoja marked this pull request as ready for review October 21, 2024 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant