Skip to content

feat: add date of birth (dob) field to Res struct and update related tests#250

Merged
lakshayman merged 2 commits intodevelopfrom
feat/add-dob
Nov 25, 2025
Merged

feat: add date of birth (dob) field to Res struct and update related tests#250
lakshayman merged 2 commits intodevelopfrom
feat/add-dob

Conversation

@vinit717
Copy link
Member

@vinit717 vinit717 commented Nov 19, 2025

Date: 22-11-26

Developer Name: @vinit717


Issue Ticket Number

Description

Add the DOB field in the Identity service

Documentation Updated?

  • Yes
  • No

Under Feature Flag

  • Yes
  • No

Database Changes

  • Yes
  • No

Breaking Changes

  • Yes
  • No

Development Tested?

  • Yes
  • No

Screenshots

Screenshot 1

Test Coverage

Screenshot 1

Additional Notes

@coderabbitai
Copy link

coderabbitai bot commented Nov 19, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Summary by CodeRabbit

  • New Features
    • Added date of birth support to user profiles, allowing users to store and manage their birth date information.
    • The field is fully integrated into profile operations including creation, updates, and data persistence.

Walkthrough

A 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

Cohort / File(s) Summary
Profile data model structure
layer/utils/constants.go
Added DOB string field to Res struct (json:"dob") and Diff struct (firestore:"dob,omitempty"); updated diffToMap function to include dob key mapping
Conversion logic
layer/utils/validation.go
Updated resToDiff and DiffToRes functions to handle DOB field conversion between Res and Diff structures
Test data and fixtures
call-profile/testdata.go, call-profile/main_test.go
Added DOB field ("1990-01-15") to test data and updated JSON payloads and mock responses to include the new field

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Changes follow existing patterns consistently across all files
  • Field additions are straightforward struct extensions with standard tags
  • Conversion logic mirrors existing patterns for other fields
  • Test updates are data-driven with no new logic

Possibly related PRs

Suggested reviewers

  • lakshayman

Poem

🐰 A birthday field hops into the profile today,
DOB joins Res and Diff without delay,
Conversions aligned, tests celebrate with glee,
Date of birth data flows through with harmony! 🎂

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a date of birth (dob) field to the Res struct and updating related tests, which aligns with all file modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The pull request description directly relates to the changeset—adding a DOB field to the Identity service, which aligns with the code changes across multiple files.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 44fbfc8 and 7c03fa7.

📒 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

@vinit717 vinit717 marked this pull request as draft November 19, 2025 17:44
@vinit717 vinit717 marked this pull request as ready for review November 24, 2025 18:07
@vinit717
Copy link
Member Author

vinit717 commented Nov 25, 2025

Will create a seprate repo for dummy profile service, as currently we have forked it

@lakshayman lakshayman merged commit 06cf450 into develop Nov 25, 2025
3 checks passed
@lakshayman lakshayman deleted the feat/add-dob branch November 25, 2025 17:10
@vinit717 vinit717 mentioned this pull request Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants