fix: Delete files on submission/question/form deletion#3335
Open
Koc wants to merge 1 commit into
Open
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
cb8497b to
00a550c
Compare
Signed-off-by: Kostiantyn Miakshyn <[email protected]>
00a550c to
7c73eca
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2676, #3061 (?)
Covered scenarios
Submission removal
We remove all files for that submission by file id. This means that we will remove file even if it has been moved outside of the form folder.
Question removal
We iterate though all submission and try to remove folder for the question for each submission by prefix
{questionId} -. Imagine that we have next file structure:forms/111 - my super form/3/22 - question1/file1.pdfforms/111 - my super form/4/22 - question1 that was renamed/file2.pdfAnd trying to remove question with id 22 Then we will remove all folders:
22 - question1and22 - question1 that was renamed.At the same time if files were moved somewhere outside of the form directory - we will keep them as is.
Form removal
We remove form folder completely by prefix
{formId} -. Imagine that we have next file structure:forms/111 - my super form/3/22 - question1/file1.pdfforms/111 - my super form renamed/4/22 - question1 that was renamed/file2.pdfAnd trying to remove form with id 111. Then we will remove all folders
At the same time if files were moved somewhere outside of the form directory - we will keep them as is.
🚧 Todo