Skip to content

Commit

Permalink
Update validation to prevent phone field from being empty
Browse files Browse the repository at this point in the history
  • Loading branch information
samau3 committed Oct 25, 2024
1 parent 9a4b9e3 commit 2406913
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default function RegisterPhysician({
firstName: isNotEmpty('First Name is required'),
lastName: isNotEmpty('Last Name is required'),
phone: (value) =>
value.length === 0 || value.match(/^\(\d{3}\) \d{3}-\d{4}$/)
value.length > 0 || value.match(/^\(\d{3}\) \d{3}-\d{4}$/)
? null
: 'Phone number is not in (XXX) XXX-XXXX format',
email: (value) =>
Expand Down
5 changes: 1 addition & 4 deletions server/routes/api/v1/physicians/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ export default async function (fastify) {
},
phone: {
type: 'string',
anyOf: [
{ pattern: '^(\\([0-9]{3}\\)) [0-9]{3}-[0-9]{4}$' },
{ pattern: '^$' },
],
pattern: '^(\\([0-9]{3}\\)) [0-9]{3}-[0-9]{4}$',
},
},
},
Expand Down

0 comments on commit 2406913

Please sign in to comment.