Skip to content

Conversation

@jmgasper
Copy link
Contributor

@jmgasper jmgasper commented Jan 9, 2026

No description provided.

...createUserDto.param,
handle: 'countryuser',
email: 'countryuser@example.com',
country: { code: 'US', isoAlpha3Code: 'USA' },
Copy link

Choose a reason for hiding this comment

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

[⚠️ correctness]
The country object in the dto includes both code and isoAlpha3Code. Ensure that the isoAlpha3Code is always provided and validated, as missing or incorrect values could lead to incorrect data being stored.

expect(mockMemberPrisma.member.create).toHaveBeenCalledWith(
expect.objectContaining({
data: expect.objectContaining({
homeCountryCode: 'USA',
Copy link

Choose a reason for hiding this comment

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

[⚠️ maintainability]
Consider adding validation to ensure that homeCountryCode and competitionCountryCode are correctly set to valid ISO Alpha-3 codes. This will prevent potential data integrity issues.

// Create the member record outside of the interactive transaction
// to avoid cross-client work while a Prisma transaction is open
try {
const isoAlpha3Code = CommonUtils.validateString(
Copy link

Choose a reason for hiding this comment

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

[⚠️ correctness]
The validateString method is used to check if userParams.country?.isoAlpha3Code is valid. Ensure that validateString correctly handles all edge cases, such as empty strings or unexpected input types, to prevent potential issues with setting homeCountryCode and competitionCountryCode to null inadvertently.

@jmgasper jmgasper merged commit 3a16441 into master Jan 9, 2026
7 checks passed
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