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

Child artifact deletion and retire #111

Merged
merged 2 commits into from
Oct 2, 2024
Merged

Child artifact deletion and retire #111

merged 2 commits into from
Oct 2, 2024

Conversation

elsaperelli
Copy link
Contributor

@elsaperelli elsaperelli commented Sep 19, 2024

Summary

This PR ensures that the Publishable Measure Repository archive DELETE and the Authoring Measure Repository withdraw DELETE interactions include handling of child artifacts. Additionally, it includes handling of child artifacts for the Publishable Measure Repository retire UPDATE interaction.

New behavior

  • When sending a DELETE request (withdraw) to an artifact with status draft, it now also deletes any resources it is composed of, recursively.
  • When sending a DELETE request (archive) to an artifact with status retired, it now also deletes any resources it is composed of, recursively.
  • When sending an UPDATE request (retire) to an artifact with status active where the only update is the date changing and the status changing to retired, it now also updates any resources it is composed of, recursively.

Code changes

  • README.md - Readme updates. Let me know if anything else should be included but the README is looking good!
  • service/src/db/dbOperations.ts - remove deleteResource function (no longer used) and add batchDelete function that deletes resources in a batch transaction.
  • service/src/services/LibraryService.ts / service/src/services/MeasureService.ts - update update to include check for retire interaction so that child artifacts can be included in the update, update remove to include handling of child artifacts in a batch delete transaction

Testing guidance

  • cd service
  • npm run db:reset
  • npm run db:loadBundle <path to nested child artifact bundle>
  • cd ..
  • npm run build:all
  • npm run check:all
  • npm run start:all
  • Attached is an Insomnia collection of some example requests, but please test the following scenarios:

Update:

  • An artifact with children with status draft - cannot update status, any other updates can only be made to individual draft artifacts (i.e., an update made to a parent artifact cannot update any of its children until further guidance is provided)
  • An artifact with children with status retired - error
  • An artifact with children with status active - can only update status to specifically retired and date, all children should also be updated

Delete:

  • An artifact with children with status draft - delete all
  • An artifact with children with status retired - delete all
  • An artifact with children with status active - error

WriteCapabilities.json

@elsaperelli elsaperelli merged commit a1535a6 into main Oct 2, 2024
2 checks passed
@elsaperelli elsaperelli deleted the write-capabilities branch October 2, 2024 13:03
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.

2 participants