Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions healthcare/fhir/deleteFhirResourcePurge.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const main = (
auth: new google.auth.GoogleAuth({
scopes: ['https://www.googleapis.com/auth/cloud-platform'],
}),
responseType: 'json',
});

const deleteFhirResourcePurge = async () => {
Expand All @@ -42,10 +43,14 @@ const main = (
const name = `projects/${projectId}/locations/${cloudRegion}/datasets/${datasetId}/fhirStores/${fhirStoreId}/fhir/${resourceType}/${resourceId}`;
const request = {name};

await healthcare.projects.locations.datasets.fhirStores.fhir.ResourcePurge(
request
);
console.log('Deleted all historical versions of resource');
try {
await healthcare.projects.locations.datasets.fhirStores.fhir.ResourcePurge(
request
);
console.log(`Purged all historical versions of resource: ${resourceId}`);
} catch (error) {
console.error('Error purging FHIR resource:', error.message || error);
}
};

deleteFhirResourcePurge();
Expand Down
4 changes: 3 additions & 1 deletion healthcare/fhir/system-test/fhir_resources.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,9 @@ it('should purge all historical versions of a FHIR resource', () => {
{cwd}
);
assert.strictEqual(
new RegExp('Deleted all historical versions of resource').test(output),
new RegExp(
`Purged all historical versions of resource: ${resourceId}`
).test(output),
true
);
});
Expand Down
Loading