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

Delete and purge individual submissions #1150

Merged
merged 23 commits into from
Sep 18, 2024
Merged

Conversation

ktuite
Copy link
Member

@ktuite ktuite commented Jun 3, 2024

Completes the Backend portion of getodk/central#667

Adds submission delete endpoint that soft-deletes a single submission, and a mechanism to purge submissions deleted for more than 30 days.

Done:

  • submission delete endpoint
  • purge mechanism
  • some tests of basic 404s on soft deleted submissions and basic purging
  • migration to add submission.delete verb
  • migration to get submission comments to cascade delete (i think) (already done)
  • more tests (see some TODOs in code) to check that everything associated with a submission is purged (versions, select multiple fields, comments, unattached blobs, etc)
  • more tests to ensure that deleted submissions are not included anywhere (in api, odata, other exports)
  • double check that deleted submissions that were entity sources do the right thing
  • figure out if there are notes in audits that need to be redacted (i think so)

Still to do (sept 9 2024)

  • make sure client audits processed from submission attachment blobs get purged properly (Check that client audits really get purged #1174)
  • write a test for checking the submission.delete audit event (its acteeId is the form it was in)
  • undelete endpoint?
  • submission purge cli and cron job (combine with form purge?)

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

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?

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

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

@ktuite ktuite force-pushed the ktuite/submission_delete branch 2 times, most recently from e6efdc2 to c13b24c Compare September 4, 2024 22:08
@ktuite ktuite linked an issue Sep 6, 2024 that may be closed by this pull request
@ktuite ktuite marked this pull request as ready for review September 13, 2024 20:31
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.

Interactive review

lib/task/purge.js Outdated Show resolved Hide resolved
lib/model/query/forms.js Show resolved Hide resolved
lib/model/query/submissions.js Outdated Show resolved Hide resolved
lib/model/query/submissions.js Outdated Show resolved Hide resolved
lib/model/query/submissions.js Show resolved Hide resolved
test/integration/other/form-purging.js Outdated Show resolved Hide resolved
test/integration/api/submissions.js Show resolved Hide resolved
test/integration/api/submissions.js Show resolved Hide resolved
test/integration/api/submissions.js Show resolved Hide resolved
@matthew-white
Copy link
Member

One thing I'm realizing is that for Frontend, we'll eventually need a way to list submissions in the trash, something like ?deleted=true for listing forms in the trash. But I think that can definitely come later. I'll mention it in the issue I file about further work related to submission deletion.

@ktuite ktuite merged commit b348912 into master Sep 18, 2024
6 checks passed
@ktuite ktuite deleted the ktuite/submission_delete branch September 18, 2024 23:18
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.

Delete submissions via API
2 participants