Skip to content

Commit

Permalink
[Fix] Postal Code Space Issue (#316)
Browse files Browse the repository at this point in the history
* Strip first solution

* Have parity between physician and applicant upsert
  • Loading branch information
ChinemeremChigbo authored and leogjhuang committed Oct 10, 2023
1 parent 4554abc commit 1a44525
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions lib/applicants/resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ export const updateApplicantDoctorInformation: Resolver<
const { id, mspNumber, ...data } = input;
const { firstName, lastName, addressLine1, addressLine2, city } = input;

const phone = stripPhoneNumber(data.phone);
const postalCode = stripPostalCode(data.postalCode);
const phone = data.phone ? stripPhoneNumber(data.phone) : null;
const postalCode = data.postalCode ? stripPostalCode(data.postalCode) : null;

try {
await requestPhysicianInformationSchema.validate({
Expand Down Expand Up @@ -345,10 +345,19 @@ export const updateApplicantDoctorInformation: Resolver<
let updatedApplicant;

try {
const upsertData = {
firstName: firstName as string,
lastName: lastName as string,
phone: phone as string,
addressLine1: addressLine1 as string,
addressLine2: addressLine2 as string | null,
city: city as string,
postalCode: postalCode as string,
};
const upsertPhysician = prisma.physician.upsert({
where: { mspNumber },
create: { mspNumber, ...data },
update: data,
create: { mspNumber, ...upsertData },
update: upsertData,
});
const updateApplicant = prisma.applicant.update({
where: { id },
Expand Down

0 comments on commit 1a44525

Please sign in to comment.