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.
Summary
This PR continues our work of ensuring that child artifacts in the measure-repository do not have a lifecycle outside of their parent artifact. This PR prevents child artifacts from being deleted from the
draft-repository
and implements recursive deletion of a parent artifact and all of its children in a batch transaction.New behavior
draft-repository
(authoring side of the app) for artifacts that are child artifacts (meaning they have theisOwned
extension).draft-repository
is now batched so that the artifact and any of its child artifacts are also deleted.Code changes
app/src/components/ResourceInfoCard.tsx
-deleteParent
trpc procedure is now used instead ofdeleteDraft
, delete button is now disabled for child artifactsapp/src/server/db/dbOperations.ts
- newbatchDeleteDraft
function to delete a parent artifact and any of its children in a batch transaction. I had to also change howbatchCreateDraft
was written because I would randomly get errors along the lines of "Given transaction number 1 does not match any in-progress transactions" and I saw that a solution was to usewithTransaction
instead.app/src/server/trpc/routers/draft.ts
- newdeleteParent
procedureapp/src/util/modifyResourceFields.ts
- fixes a bug I found- basically if a parent artifact was drafted and the version had to be incremented more than once, then we had to make sure the same happened to the version in the reference in relatedArtifactsapp/src/util/resourceCardUtils.ts
/app/src/util/types/fhir.ts
- newisChild
property to be used in theResourceInfoCard.tsx
component to determine whether to disable the delete button or notTesting guidance
npm run check:all
npm run start:all
cd service
npm run db:reset
npm run db:loadBundle <path-to-bundle>
(use the edited ColorectalCancerScreeningsFHIR bundle I made for Fix recursion #90)npm run start:all
draft-repository
. There should hopefully be a clearer lifecycle now of drafting, deleting, and releasing parent artifacts and their children, but try your best to break it.