-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add REST Endpoint for DAC Application Approval with Validation and State Management #148
base: main
Are you sure you want to change the base?
Conversation
}); | ||
return; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have the Prettier extension installed? There are whitespace changes here which don't match what I'd expect to see
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed adding Prettier under my extention list, will surely keep in mind for the next time. Thanks for noticing!
@@ -0,0 +1,23 @@ | |||
import { ApplicationStates, ApplicationStateValues } from "@pcgl-daco/data-model/src/types.js"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a) new files need the Copyright at the top
b) We have ApplicationStateManager defined at https://github.com/Pan-Canadian-Genome-Library/daco/blob/main/apps/api/src/api/states.ts#L61
which extends functionality https://github.com/eram/typescript-fsm
including the .can
method which could essentially perform the same function as this.
I would use the existing class and work within that framework.
Now, there may not be implementation examples for the State Machine yet in the API, except for in the unit tests: https://github.com/Pan-Canadian-Genome-Library/daco/blob/main/apps/api/tests/api/application-state.test.ts
So I can review this with you and show how Jon and I were intending to implement the state machine and action updates
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Off to a great start, handful of changes to iron out first
applicationId, | ||
approverId, | ||
applicationId, | ||
approverId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approverId
is unused here
success: false, | ||
message: 'Application not found.', | ||
errors: 'ApplicationNotFound', | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can just be (!result.success) { return result }
The success, errors and message will already be populated by getApplicationById
Summary
#117- Introduced a new REST endpoint that allows DAC (Data Access Committee) members to approve applications. This feature ensures robust state transitions, clear validations, and comprehensive user feedback.
Description of Changes
API
New Endpoint:
POST /applications/{applicationId}/approve
applicationId
andapproverId
as required fields and ensures they are numbers.approved
and integrates with the state transition machine.approved
applications by any user.Response:
Swagger Documentation:
Service
Data Model
Special Instructions
Before running these changes: