-
Notifications
You must be signed in to change notification settings - Fork 61
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
fix(driving-license): Prevent temp license holders from applying for BE license #15278
Conversation
WalkthroughThe recent updates enhance the functionality related to different types of driving licenses, specifically handling categories and associated validity codes for temporary, full, and BE (trailer) licenses. Additionally, messages and service methods have been updated to include new parameters like Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant ApplicationForm
participant ApplicationService
participant DrivingLicenseApi
User->>ApplicationForm: Fill license application form
ApplicationForm->>ApplicationService: Submit form (includes instructorSSN, studentEmail, primaryPhoneNumber)
ApplicationService->>DrivingLicenseApi: applyForBELicense(input)
DrivingLicenseApi->>ApplicationService: API response
ApplicationService->>ApplicationForm: Success/Failure response
ApplicationForm->>User: Display confirmation message
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
Datadog ReportAll test runs ✅ 9 Total Test Services: 0 Failed, 8 Passed Test Services
🔻 Code Coverage Decreases vs Default Branch (1)
|
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: 0
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (2)
- libs/application/templates/driving-license/src/forms/prerequisites/sectionApplicationFor.ts (2 hunks)
- libs/application/templates/driving-license/src/lib/types.ts (1 hunks)
Additional context used
Path-based instructions (2)
libs/application/templates/driving-license/src/lib/types.ts (1)
Pattern
libs/**/*
: "Confirm that the code adheres to the following:
- Reusability of components and hooks across different NextJS apps.
- TypeScript usage for defining props and exporting types.
- Effective tree-shaking and bundling practices."
libs/application/templates/driving-license/src/forms/prerequisites/sectionApplicationFor.ts (1)
Pattern
libs/**/*
: "Confirm that the code adheres to the following:
- Reusability of components and hooks across different NextJS apps.
- TypeScript usage for defining props and exporting types.
- Effective tree-shaking and bundling practices."
Additional comments not posted (2)
libs/application/templates/driving-license/src/lib/types.ts (1)
13-13
: The addition ofvalidToCode
toDrivingLicenseCategory
aligns well with the PR objectives and appears to be correctly implemented.libs/application/templates/driving-license/src/forms/prerequisites/sectionApplicationFor.ts (1)
Line range hint
50-91
: The logic to exclude temporary licenses from applying for a BE license is correctly implemented and aligns with the PR objectives. Ensure that all conditions, especially the complex conditional at lines 88-91, are thoroughly tested to prevent any unintended behavior.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #15278 +/- ##
==========================================
+ Coverage 37.13% 37.24% +0.10%
==========================================
Files 6504 6489 -15
Lines 132230 131860 -370
Branches 37804 37632 -172
==========================================
+ Hits 49101 49106 +5
+ Misses 83129 82754 -375
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 120 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
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: 0
Outside diff range and nitpick comments (5)
libs/application/template-api-modules/src/lib/modules/templates/driving-license-submission/driving-license-submission.service.ts (2)
Line range hint
40-40
: ISSUE: Incorrect use of decorators.The use of decorators here is flagged as invalid. Ensure that decorators are used in the correct context and configuration settings are adjusted if necessary.
Tools
Biome
[error] 199-216: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Line range hint
183-216
: REFACTOR SUGGESTION: Remove unnecessary else clauses.The
else
clauses in lines 183-216, 199-216, and 243-247 are unnecessary as the previous branches in the conditional statements break early. Removing these will simplify the control flow and improve readability.- else { - throw new Error('application for unknown type of license') - }Also applies to: 199-216, 243-247
Tools
Biome
[error] 199-216: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
libs/api/domains/driving-license/src/lib/drivingLicense.service.ts (3)
Line range hint
53-53
: ISSUE: Incorrect use of decorators.The use of decorators here is flagged as invalid. Ensure that decorators are used in the correct context and configuration settings are adjusted if necessary.
Line range hint
238-238
: REFACTOR SUGGESTION: Use optional chaining.Consider using optional chaining to simplify null checks and improve code readability.
- if ((e as { status: number })?.status === 404) { + if (e?.status === 404) {
Line range hint
362-373
: REFACTOR SUGGESTION: Remove unnecessary else clauses.The
else
clauses in lines 362-373, 367-373, and 371-373 are unnecessary as the previous branches in the conditional statements break early. Removing these will simplify the control flow and improve readability.- else { - throw new Error('unhandled license type') - }Also applies to: 367-373, 371-373
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (6)
- libs/api/domains/driving-license/src/lib/drivingLicense.service.ts (2 hunks)
- libs/api/domains/driving-license/src/lib/drivingLicense.type.ts (1 hunks)
- libs/application/template-api-modules/src/lib/modules/templates/driving-license-submission/driving-license-submission.service.ts (1 hunks)
- libs/application/templates/driving-license/src/lib/messages.ts (1 hunks)
- libs/clients/driving-license/src/lib/drivingLicenseApi.service.ts (2 hunks)
- libs/clients/driving-license/src/v5/clientConfig.json (3 hunks)
Files not reviewed due to errors (1)
- libs/clients/driving-license/src/lib/drivingLicenseApi.service.ts (no review received)
Files skipped from review due to trivial changes (1)
- libs/application/templates/driving-license/src/lib/messages.ts
Additional context used
Path-based instructions (5)
libs/api/domains/driving-license/src/lib/drivingLicense.type.ts (1)
Pattern
libs/**/*
: "Confirm that the code adheres to the following:
- Reusability of components and hooks across different NextJS apps.
- TypeScript usage for defining props and exporting types.
- Effective tree-shaking and bundling practices."
libs/application/template-api-modules/src/lib/modules/templates/driving-license-submission/driving-license-submission.service.ts (1)
Pattern
libs/**/*
: "Confirm that the code adheres to the following:
- Reusability of components and hooks across different NextJS apps.
- TypeScript usage for defining props and exporting types.
- Effective tree-shaking and bundling practices."
libs/api/domains/driving-license/src/lib/drivingLicense.service.ts (1)
Pattern
libs/**/*
: "Confirm that the code adheres to the following:
- Reusability of components and hooks across different NextJS apps.
- TypeScript usage for defining props and exporting types.
- Effective tree-shaking and bundling practices."
libs/clients/driving-license/src/lib/drivingLicenseApi.service.ts (1)
Pattern
libs/**/*
: "Confirm that the code adheres to the following:
- Reusability of components and hooks across different NextJS apps.
- TypeScript usage for defining props and exporting types.
- Effective tree-shaking and bundling practices."
libs/clients/driving-license/src/v5/clientConfig.json (1)
Pattern
libs/**/*
: "Confirm that the code adheres to the following:
- Reusability of components and hooks across different NextJS apps.
- TypeScript usage for defining props and exporting types.
- Effective tree-shaking and bundling practices."
Biome
libs/application/template-api-modules/src/lib/modules/templates/driving-license-submission/driving-license-submission.service.ts
[error] 40-40: Decorators are not valid here. (parse)
Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting theunsafeParameterDecoratorsEnabled
option totrue
in your configuration file.
[error] 183-216: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 199-216: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
[error] 243-247: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
libs/api/domains/driving-license/src/lib/drivingLicense.service.ts
[error] 53-53: Decorators are not valid here. (parse)
Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting theunsafeParameterDecoratorsEnabled
option totrue
in your configuration file.
[error] 238-238: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 362-373: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 367-373: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
[error] 371-373: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
libs/clients/driving-license/src/lib/drivingLicenseApi.service.ts
[error] 178-178: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
Gitleaks
libs/clients/driving-license/src/lib/drivingLicenseApi.service.ts
603-603: Detected a Generic API Key, potentially exposing access to various services and sensitive operations. (generic-api-key)
Additional comments not posted (4)
libs/api/domains/driving-license/src/lib/drivingLicense.type.ts (1)
28-33
: APPROVED: New interfaceNewBEDrivingLicenseInput
added successfully.The new interface
NewBEDrivingLicenseInput
has been added to define the structure of the input for BE license applications, which aligns with the PR objectives to enhance input handling for BE License applications.libs/clients/driving-license/src/v5/clientConfig.json (3)
2991-2994
: Added configuration for 'districtId' in JSON schemaThe addition of the
districtId
with a description and type specification is a good practice, ensuring clarity and type safety in the API's data contracts. However, consider adding whether this field is required or not to align with other fields in your schema.
3414-3428
: Added new fields to 'PostApplicationForBEModel' schemaThe addition of
instructorSSN
,primaryPhoneNumber
, andstudentEmail
fields, all marked as nullable, aligns with the PR's objective to enhance handling for BE license applications. This is a positive change, enhancing the detail and functionality of the API. Ensure that the nullable nature of these fields is intended and aligns with business logic.
3874-3877
: Configuration added for 'districtId' in 'TemporaryLicenseStatisticsDetailedDto'The addition of
districtId
to the statistics DTO schema is appropriate for detailed tracking and reporting. The explicit type and format declaration enhances the robustness of the API. Ensure consistency in how this field is used or required across different parts of the application.
...
Attach a link to issue if relevant
What
Specify what you're trying to achieve
Why
Specify why you need to achieve this
Screenshots / Gifs
Attach Screenshots / Gifs to help reviewers understand the scope of the pull request
Checklist:
Summary by CodeRabbit
New Features
temp
,full
,BE
).BE
license.Improvements
Refactor
BE
license application.