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

Expose operation #106

Merged
merged 9 commits into from
Aug 21, 2024
Merged

Expose operation #106

merged 9 commits into from
Aug 21, 2024

Conversation

elsaperelli
Copy link
Contributor

Summary

This PR exposes the $approve operation as an endpoint on the server. This functionality is defined in the CRMI IG here.

New behavior

The user can now approve a Measure or Library artifact and any resources it is composed of regardless of status by sending a GET or POST request to Measure/$approve, Measure/:id/$approve, Library/$approve and Library/:id/$approve. This operation takes three optional parameters: approvalDate, artifactAssessmentType, and artifactAssessmentSummary. If artifactAssessmentType and artifactAssessmentSummary are both provided, then a cqf-artifactComment extension will be added to the artifact and any of its children. If approvalDate is provided, the approvalDate is set, if not, it is set to the system. The date is also set to the system date. Since this is only an operation supported in an Authoring Artifact Repository, the AUTHORING environment variable must be set to true.

Code changes

  • service/README.md - add description of $approve
  • service/src/config/capabilityStatementResources.json - add crmi-approve
  • service/src/config/serverConfig.ts - add approve endpoints
  • service/src/db/dbOperations.ts - add batchUpdate function
  • service/src/requestSchemas - add id and type and summary checks and ApproveArgs for type checking
  • service/src/services/LibraryService.ts / service/src/services/MeasureService.ts - add approve function
  • service/src/util/inputUtils.ts - add valueCode to gatherParams
  • service/test/services/LibraryService.test.ts / service/test/services/MeasureService.test.ts - added unit tests

Testing guidance

  • npm run build:all
  • npm run check:all
  • In service, reset the database (npm run db:reset) and test with the nested child artifact bundle I made and may connectathon bundles (attached example Insomnia requests are for use with the created nested artifact bundle
  • npm run start:all
  • Go through example Insomnia requests. Make sure date and approvalDate are changed/added, extension is added if artifactAssessmentSummary AND artifactAssessmentType are included as input parameters, etc.

approve-testing.json

Copy link
Contributor

@lmd59 lmd59 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functionality looks pretty good! A couple of small change recommendations!

service/src/db/dbOperations.ts Outdated Show resolved Hide resolved
service/src/requestSchemas.ts Outdated Show resolved Hide resolved
service/src/services/LibraryService.ts Outdated Show resolved Hide resolved
service/src/services/LibraryService.ts Outdated Show resolved Hide resolved
service/src/services/LibraryService.ts Outdated Show resolved Hide resolved
service/test/services/LibraryService.test.ts Show resolved Hide resolved
service/test/services/MeasureService.test.ts Show resolved Hide resolved
@elsaperelli elsaperelli requested a review from lmd59 August 19, 2024 17:03
service/src/util/serviceUtils.ts Show resolved Hide resolved
service/src/util/serviceUtils.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@lmd59 lmd59 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice updates!

@elsaperelli elsaperelli merged commit f2dbef2 into main Aug 21, 2024
2 checks passed
@elsaperelli elsaperelli deleted the expose-approve branch August 21, 2024 15:40
@lmd59 lmd59 mentioned this pull request Aug 21, 2024
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