-
Notifications
You must be signed in to change notification settings - Fork 16
fix: 1857 Signature in casesheet enhancement #96
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
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughIntroduces a username-based fallback to fetch a user ID before downloading a signature in the doctor diagnosis case sheet component. Adds a new DoctorService.getUserId API method and a corresponding environment URL. Updates the component with a new public userName property and an observable flow with improved error logging. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant Component as DoctorDiagnosisCaseSheetComponent
participant DoctorService
participant UserAPI as UserId API
participant SignAPI as Signature API
User->>Component: downloadSign()
alt tCSpecialistUserID present
Component->>SignAPI: GET signature(tCSpecialistUserID)
SignAPI-->>Component: signature blob/bytes
else missing tCSpecialistUserID
Component->>DoctorService: getUserId(userName)
DoctorService->>UserAPI: GET /user/userName/{userName}
UserAPI-->>DoctorService: { userId }
DoctorService-->>Component: userId
Component->>SignAPI: GET signature(userId)
SignAPI-->>Component: signature blob/bytes
end
Note over Component: On error, log descriptive message
Estimated code review effortπ― 2 (Simple) | β±οΈ ~10 minutes Poem
Pre-merge checks and finishing touchesβ Passed checks (3 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. π§ͺ Early access (Sonnet 4.5): enabledWe are currently testing the Sonnet 4.5 model, which is expected to improve code review quality. However, this model may lead to increased noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience. Note:
Comment |
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.
Actionable comments posted: 2
π§Ή Nitpick comments (1)
src/app/app-modules/nurse-doctor/shared/services/doctor.service.ts (1)
2851-2854: Consider stricter typing for better type safety.The
userNameparameter is typed asany, and the return type is implicit. For better type safety and code clarity, consider:- /* Get UserID using UserName */ - getUserId(userName: any) { - return this.http.get(environment.getUserId + userName); - } + /* Get UserID using UserName */ + getUserId(userName: string): Observable<any> { + return this.http.get(environment.getUserId + userName); + }
π Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
π Files selected for processing (3)
src/app/app-modules/nurse-doctor/case-sheet/general-case-sheet/doctor-diagnosis-case-sheet/doctor-diagnosis-case-sheet.component.ts(3 hunks)src/app/app-modules/nurse-doctor/shared/services/doctor.service.ts(1 hunks)src/environments/environment.ci.ts.template(1 hunks)
π§° Additional context used
πͺ GitHub Actions: ESLint and NPM Audit
src/app/app-modules/nurse-doctor/case-sheet/general-case-sheet/doctor-diagnosis-case-sheet/doctor-diagnosis-case-sheet.component.ts
[error] 384-384: prettier/prettier: Delete Β·
πͺ GitHub Check: lint-and-audit / lint-and-audit
src/app/app-modules/nurse-doctor/shared/services/doctor.service.ts
[failure] 2855-2855:
Delete Β·Β·
src/app/app-modules/nurse-doctor/case-sheet/general-case-sheet/doctor-diagnosis-case-sheet/doctor-diagnosis-case-sheet.component.ts
[failure] 385-385:
Delete Β·
[failure] 384-384:
Delete Β·
π Additional comments (4)
src/environments/environment.ci.ts.template (1)
498-499: LGTM! Clean environment configuration addition.The new
getUserIdendpoint configuration follows the established pattern and correctly constructs the URL for username-based user ID lookups.src/app/app-modules/nurse-doctor/case-sheet/general-case-sheet/doctor-diagnosis-case-sheet/doctor-diagnosis-case-sheet.component.ts (3)
32-32: LGTM! Appropriate RxJS imports.The import of
mapandObservablefrom rxjs is necessary to support the new observable-basedgetUserId()flow.
385-398: Clean fallback logic with improved error handling.The updated
downloadSign()method introduces a sensible fallback: iftCSpecialistUserIDis missing, it retrieves the user ID via username. The error logging is also more descriptive.However, this logic depends on
userNamebeing properly initialized (see separate comment on line 104).Also note: trailing whitespace at lines 384 and 385 must be removed to pass linting.
- - downloadSign() { + + downloadSign() {
400-404: LGTM! Well-structured helper method.The
getUserId()method correctly wraps the service call and extracts theuserIdfrom the response using themapoperator, with a fallback tonullif unavailable.
...heet/general-case-sheet/doctor-diagnosis-case-sheet/doctor-diagnosis-case-sheet.component.ts
Show resolved
Hide resolved
src/app/app-modules/nurse-doctor/shared/services/doctor.service.ts
Outdated
Show resolved
Hide resolved
|



π Description
JIRA ID:
https://support.piramalfoundation.org/jira/browse/AMM-1857
β Type of Change
Summary by CodeRabbit