Change document modified_at to only update when uploading a new file #524
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.
Hitas Pull Request
Description
Documents have a user-visible timestamp for creation and modification. The modification timestamp currently updates for all documents relating to an apartment or housing company when the documents form is submitted. This is because the React form and DRF by default work so that they always save the fields even if they haven't changed.
This PR solves the issue by explicitly only updating the
modified_at
when a file is uploaded instead of automatically on every.save()
. This could have also been solved by checking for changes in the frontend or backend but currently we are only interested in when the document file itself was last updated. This could also have been a new timestamp field but I decided against that as too much overengineering.The migration in this PR is no-op:
Pull request checklist
Check the boxes for each DoD item that has been completed:
Tickets
HT-769