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

Bug/nrpti 1091 #1099

Merged
merged 5 commits into from
Sep 13, 2023
Merged

Bug/nrpti 1091 #1099

merged 5 commits into from
Sep 13, 2023

Conversation

davidclaveau
Copy link
Contributor

@davidclaveau davidclaveau commented Sep 8, 2023

Changelog:

  • Add a migration to remove any orphaned "documents" ObjectIDs from the redacted_record_subset collection
    • These "documents" ObjectIDs do not correspond to an ObjectID in either the nrpti or redacted collections (they should exists as {"_schemaName": "Document"})
    • This means the "Document" record has been deleted previously from the S3 bucket
    • An ObjectID in a record's "documents" array in redacted will show on the NRCED frontend that a document (PDF, image, etc.) exists, but is unable to actually retrieve an existing document, which may prove confusing to the user.

Migration explanation:

  • The migration checks in the redacted collection for records that have a non-empty "documents" array and saves the corresponding "documents" ObjectIDs in a separate array
  • It matches the "documents" ObjectIDs to both the nrpti and redacted_record_subset collections, checking if a {"_schemaName": "Document"} exists
    • If it exists, then the corresponding S3 link would still be available from this record
  • Any non-matching ObjectIDs are noted in a separate array
  • We use MongoDB $pull to update the redacted collection's records to remove any of these non-matching ObjectIDs from their "documents" arrays.

@davidclaveau davidclaveau marked this pull request as ready for review September 8, 2023 19:43
@sonarcloud
Copy link

sonarcloud bot commented Sep 13, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 3 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@davidclaveau davidclaveau merged commit 69ee606 into master Sep 13, 2023
4 checks passed
@davidclaveau davidclaveau deleted the bug/nrpti-1091 branch September 13, 2023 23:46
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.

4 participants