Skip to content

Commit

Permalink
VSR pages 2/3 integration fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminJohnson2204 committed Mar 14, 2024
1 parent 08faed5 commit abf6918
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 92 deletions.
84 changes: 0 additions & 84 deletions backend/src/validators/vsr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,90 +202,6 @@ const updateStatusValidator = () =>
.isIn(ALLOWED_STATUSES)
.withMessage("Status must be one of the allowed options");

const makeHearFromValidator = () =>
body("hearFrom")
.exists({ checkFalsy: true })
.withMessage("Hear from is required")
.isString()
.withMessage("Hear from must be a string");

const makePetCompanionValidator = () =>
body("petCompanion")
.exists({ checkFalsy: true })
.withMessage("Pet companion is required")
.isBoolean()
.withMessage("Pet companion must be a boolean");

const makeMilitaryIdValidator = () =>
body("militaryId")
.exists({ checkFalsy: true })
.withMessage("Military Id is required")
.isInt()
.withMessage("Military Id must be an integer");

const makeLastRankValidator = () =>
body("lastRank")
.exists({ checkFalsy: true })
.withMessage("Last rank is required")
.isString()
.withMessage("Last rank must be a string");

const makeServiceConnectedValidator = () =>
body("serviceConnected")
.exists({ checkFalsy: true })
.withMessage("Service connected is required")
.isBoolean()
.withMessage("Service connected must be a boolean");

const makeDischargeStatusValidator = () =>
body("dischargeStatus")
.exists({ checkFalsy: true })
.withMessage("Discharge status is required")
.isString()
.withMessage("Discharge status must be a string");

const makeEmailValidator = () =>
body("email")
.exists({ checkFalsy: true })
.withMessage("Email is required")
.isString()
.withMessage("Email must be a string");

const makePhoneNumberValidator = () =>
body("phoneNumber")
.exists({ checkFalsy: true })
.withMessage("Phone number is required")
.isString()
.withMessage("Phone number must be a string");

const makeZipCodeValidator = () =>
body("zipCode")
.exists({ checkFalsy: true })
.withMessage("Zip code is required")
.isInt({ min: 0 })
.withMessage("Zip code must be a positive integer");

const makeStateValidator = () =>
body("state")
.exists({ checkFalsy: true })
.withMessage("State is required")
.isString()
.withMessage("State must be a string");

const makeCityValidator = () =>
body("city")
.exists({ checkFalsy: true })
.withMessage("City is required")
.isString()
.withMessage("City must be a string");

const makeStreetAddressValidator = () =>
body("streetAddress")
.exists({ checkFalsy: true })
.withMessage("Street address is required")
.isString()
.withMessage("Street address must be a string");

export const createVSR = [
makeNameValidator(),
makeGenderValidator(),
Expand Down
1 change: 0 additions & 1 deletion frontend/src/api/VSRs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ export interface CreateVSRRequest {
hearFrom: string;
selectedFurnitureItems: FurnitureInput[];
additionalItems: string;
status: string;
}

function parseVSR(vsr: VSRJson) {
Expand Down
1 change: 0 additions & 1 deletion frontend/src/app/vsr/page.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@
.submit {
width: 306px;
height: 64px;
background-color: #102d5f;
color: white;
cursor: pointer;
font-family: "Lora";
Expand Down
11 changes: 5 additions & 6 deletions frontend/src/app/vsr/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ const VeteranServiceRequest: React.FC = () => {
employmentStatus: data.employment_status,
incomeLevel: data.income_level,
sizeOfHome: data.size_of_home,

streetAddress: data.streetAddress,
city: data.city,
state: data.state,
Expand All @@ -288,7 +288,7 @@ const VeteranServiceRequest: React.FC = () => {
militaryID: data.militaryID,
petCompanion: data.petCompanion,
hearFrom: data.hearFrom,

// Only submit items that the user selected at least 1 of
selectedFurnitureItems: Object.values(selectedFurnitureItems).filter(
(selectedItem) => selectedItem.quantity > 0,
Expand All @@ -311,7 +311,6 @@ const VeteranServiceRequest: React.FC = () => {
}
};


const incrementPageNumber = () => {
setPageNumber(pageNumber + 1);
};
Expand Down Expand Up @@ -952,7 +951,7 @@ const VeteranServiceRequest: React.FC = () => {
className={`${styles.submit} ${isValid ? styles.enabled : styles.disabled}`}
type="submit"
>
Submit
Next
</button>
</div>
</div>
Expand All @@ -961,7 +960,7 @@ const VeteranServiceRequest: React.FC = () => {
</div>
);
} else {
return (
return (
<div className={styles.page}>
<form onSubmit={handleSubmit(onSubmit)}>
<HeaderBar />
Expand Down Expand Up @@ -1017,7 +1016,7 @@ const VeteranServiceRequest: React.FC = () => {
{/* TODO: better error handling */}
{errorMessage}
</div>
);
);
}
};

Expand Down

0 comments on commit abf6918

Please sign in to comment.