feat: add date of birth (dob) field to Res struct and update related tests#250
feat: add date of birth (dob) field to Res struct and update related tests#250lakshayman merged 2 commits intodevelopfrom
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Summary by CodeRabbit
WalkthroughA new "dob" (date of birth) field is added to the user profile data model. The change extends the Res and Diff structs in constants.go, adds conversion logic in validation.go to map the field between structures, and updates test data and fixtures to include the new field. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Possibly related PRs
Suggested reviewers
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
layer/utils/validation.go (1)
51-63: Add validation for the DOB field.The DOB field is missing validation rules. Consider adding:
- Format validation to ensure consistent date format (e.g., ISO 8601: YYYY-MM-DD)
- Optionally, range validation to prevent future dates or unrealistic birthdates
Apply this diff to add DOB format validation:
func (res Res) Validate() error { return validation.ValidateStruct(&res, validation.Field(&res.FirstName, validation.Required), validation.Field(&res.LastName, validation.Required), validation.Field(&res.Phone, validation.Required, is.Digit), validation.Field(&res.Email, validation.Required, is.Email), validation.Field(&res.YOE, validation.Min(0)), validation.Field(&res.Company, validation.Required), validation.Field(&res.Designation, validation.Required), validation.Field(&res.GithubId, validation.Required), validation.Field(&res.LinkedIn, validation.Required), + validation.Field(&res.DOB, validation.Date("2006-01-02")), validation.Field(&res.Website, is.URL)) }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (4)
call-profile/main_test.go(4 hunks)call-profile/testdata.go(2 hunks)layer/utils/constants.go(3 hunks)layer/utils/validation.go(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: run_tests
- GitHub Check: run_tests
🔇 Additional comments (3)
layer/utils/validation.go (1)
29-29: LGTM: DOB field mappings are correct.The DOB field is properly mapped in both conversion functions, maintaining consistency with other field mappings.
Also applies to: 47-47
layer/utils/constants.go (1)
31-31: LGTM: DOB field additions are consistent.The DOB field is properly added to both Res and Diff structs with appropriate tags, and correctly included in the diffToMap function.
However, note that DOB is Personally Identifiable Information (PII). Ensure that:
- The application complies with privacy regulations (GDPR, CCPA, etc.)
- DOB data is properly encrypted in transit and at rest
- Appropriate data retention and deletion policies are in place
- DOB is not logged in plain text
Consider adding a comment documenting the expected format for the DOB field:
// DOB represents the user's date of birth in ISO 8601 format (YYYY-MM-DD) DOB string `json:"dob"`Also applies to: 50-50, 104-104
call-profile/main_test.go (1)
322-322: LGTM: Test data properly extended with DOB field.The DOB field is correctly added to test fixtures and mock responses with consistent YYYY-MM-DD format, ensuring the field flows through the entire pipeline from user data to API responses.
Also applies to: 341-342, 527-527, 546-547
|
Will create a seprate repo for dummy profile service, as currently we have forked it |
Date: 22-11-26
Developer Name: @vinit717
Issue Ticket Number
Description
Add the DOB field in the Identity service
Documentation Updated?
Under Feature Flag
Database Changes
Breaking Changes
Development Tested?
Screenshots
Screenshot 1
Test Coverage
Screenshot 1
Additional Notes