-
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(new-primary-school): Use guardian role instead of parent #17269
Conversation
WalkthroughThe pull request introduces a minor modification to the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Tip CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command 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 using PR comments)
Other keywords and placeholders
Documentation and Community
|
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.
LGTM
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #17269 +/- ##
==========================================
- Coverage 35.72% 35.72% -0.01%
==========================================
Files 6944 6944
Lines 148493 148493
Branches 42381 42386 +5
==========================================
- Hits 53043 53042 -1
- Misses 95450 95451 +1 Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1 file with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
Datadog ReportAll test runs ✅ 38 Total Test Services: 0 Failed, 35 Passed Test ServicesThis report shows up to 10 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
🧹 Nitpick comments (2)
libs/application/template-api-modules/src/lib/modules/templates/new-primary-school/new-primary-school.utils.ts (2)
Line range hint
1-168
: Consider enhancing type safety for role strings.While the implementation is functional, we could improve type safety by defining an enum or union type for the agent roles to prevent potential typos and ensure consistency across the codebase.
Consider adding a type definition like this:
export type AgentRole = 'guardian' | 'sibling' | /* other valid roles */;Then update the AgentDto interface to use this type:
interface AgentDto { // ... other fields role: AgentRole; }
Line range hint
76-85
: TODO comments need attention.There are two TODO comments regarding reason validation and sibling relation options that should be addressed:
- Validation of selected reasons
- Missing sibling relation options in key-options endpoint
Would you like me to help create GitHub issues to track these TODOs?
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
libs/application/template-api-modules/src/lib/modules/templates/new-primary-school/new-primary-school.utils.ts
(2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
libs/application/template-api-modules/src/lib/modules/templates/new-primary-school/new-primary-school.utils.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 (2)
libs/application/template-api-modules/src/lib/modules/templates/new-primary-school/new-primary-school.utils.ts (2)
49-49
: LGTM! Role designation change is consistent and appropriate.
The change from 'parent' to 'guardian' is applied consistently for both parent1 and parent2, which aligns with the PR objectives and provides more inclusive terminology.
Also applies to: 62-62
Line range hint 1-168
: Verify the impact of role change on the MMS/Frigg client.
Since this change modifies the role value sent to the FormDto/AgentDto from the MMS/Frigg client, we should verify that the 'guardian' role is properly handled by the API.
✅ Verification successful
Let me verify the role value change by searching for role-related code in the codebase.
Let me search for more context about the AgentDto interface and role handling.
Based on the search results, I can see that the role value 'guardian' is being used consistently in the new primary school application template, and there is no validation or role-specific logic in the MMS/Frigg client that would be impacted by this role value. The role is simply passed through as a string value in the AgentDto.
The change from 'parent' to 'guardian' role is safe to proceed with.
The evidence shows:
- The role 'guardian' is already being used in the same file for both parent1 and parent2
- No role validation or role-specific logic exists in the MMS/Frigg client
- The role is used purely for identification purposes in the DTO
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for role validation or role-specific logic in the MMS/Frigg client code
ast-grep --pattern 'interface AgentDto {
$$$
role: $_
$$$
}'
# Search for any hardcoded 'parent' role references that might need updating
rg -i "role.*['\"]parent['\"]"
Length of output: 131070
Script:
#!/bin/bash
# Search for role validation or role-specific logic in the MMS/Frigg client
rg -A 2 -B 2 "role.*['\"]guardian['\"]"
# Search for AgentDto interface definition
rg -A 5 "interface AgentDto"
Length of output: 1465
Script:
#!/bin/bash
# Search for AgentDto type definitions and imports
rg -A 5 "from '@island.is/clients/mms/frigg'"
# Search for any role-related validation or type definitions
rg -A 5 "type.*Role|enum.*Role|interface.*Role"
# Search for role property usage in tests
rg -A 2 "role: ['\"](parent|guardian)['\"]" "**/*.spec.ts" "**/*.test.ts"
Length of output: 66756
...
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
Bug Fixes