Skip to content

Commit

Permalink
Merge pull request #586 from code4romania/fix/582
Browse files Browse the repository at this point in the history
fix: [582] phone number validation required on optional fields
  • Loading branch information
dragos1195 committed Jul 18, 2024
2 parents 0935ab4 + dcb4b2b commit 250c4cd
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 51 deletions.
47 changes: 0 additions & 47 deletions backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ export class CreateOrganizationGeneralDto {

/* Organization short description */
@IsString()
@Length(50, 250)
@Length(50, 275) // In the frontend there should be a 250 limit, but due to '\r\n' characters being counted, we need to increase the limit
shortDescription?: string;

/* Organization long description */
@IsString()
@Length(500, 2000)
@Length(500, 2100) // In the frontend there should be a 2000 limit, but due to '\r\n' characters being counted, we need to increase the limit
description?: string;

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export const OrganizationLegalConfig: Record<string, any> = {
message: translations.phone.minim,
},
validate: (value: string) => {
return isValidPhoneNumber(value || '') || translations.phone.invalid;
return value ? isValidPhoneNumber(value || '') || translations.phone.invalid : null;
},
},
config: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export const DirectorConfig: Record<string, any> = {
message: translations.phone.minim,
},
validate: (value: string) => {
return isValidPhoneNumber(value || '') || translations.phone.invalid;
return value ? isValidPhoneNumber(value || '') || translations.phone.invalid : null;
},
},
config: {
Expand Down

0 comments on commit 250c4cd

Please sign in to comment.