Skip to content

Commit

Permalink
Feature/harsh samvrit/delete vsr (#25)
Browse files Browse the repository at this point in the history
* Added folders for page routing

* lint fixes

* Added route to POST and VSR controller

* Added basic contents for individual view

* Formatted content and added fonts

* Fixed some formatting, specifically for Contact Info

* Added all contents for the sections (working on details and components within)

* Added validation functions for form responses

* Added validation functions for form responses

* Removed numOfBoys, numOfGirls from schema, cleaned up backend, renamed martial to marital

* Added tests for validate spouse name

* Added tests for validate ethnicity

* Basic text field, multiple choice, dropdown, and submit

* Fix linting issues and minor edit to gender field validation

* Added top buttons and remaining detail styles (need to fix fonts and formatting, add lower button)

* app now uses post route

* Attempt at linking front end with back end, onbooarding code for front end api requests imported and adjusted

* Reworked TextField component to do ref-forwarding, successfully pushed a document to the mongo database

* Finished formatting page content (need to add function to buttons)

* created major components, missing details and dropdown

* Fixed couple bugs with date verification

* Removed forwardRef

* Minor commit before merging in branch

* adjusting table styling

* Backend connection works - able to retrieve data

* Retrieved more data and removed the hard-coded values

* Added title and description, required fields, and overall more styling

* updated date to use current date, added more fields for the vsr page

* Prototype of ethnicity selector

* Made options unselectable

* Working version of ethnicity form

* Finished frontend

* Prototype of appearing and disappearing children form

* Finalized frontent with last button and N/A styling

* Removed unused variables

* Modified unused message variable in requests.ts

* Added sample data file

* Added gap between list items

* Removed padding after list items

* Moved components folder out of app director

* Removed package-lock json

* Removed package lock json from backend

* Add package lock back to backend

* Add package lock back to frontend

* Updated packag lock for frontend

* Added cache section to frontent package json

* Add next SWC to frontend package-lock.json

* Updated display to check empty lists, routed toDashboard, removed unused code, included getVSR error handling

* started working on delete vsr; todo: copy over vsr model from pr #17 and finish route

* Created subfolders for components, fixed scrolling for dropdown, added minor changes to styling

* Remove unused code

* Minor styling fixes to status dropdown

* Rename UserTag to VeteranTag, move individual getVSR, change name display condition

* Use semantic HTML for VSR individual buttons

* Accordion accessibility improvements

* Added more styling

* adjusting alignment

* Added backend functionality for ages, changed Child #n name to Child #n age

* Fixed small bug with ethnicity, added numBoys and spouse to createVSR, and continued styling

* copied over vsr model and created backend delete route

* fixed issue with ethnicity selection

* Changed textbox styling to flex 1

* Fixed issue with null values in age array

* Page number component

* added girls form

* changes with validation

* starting frontend for popup

* getting all vsrs backend progress

* Yet even more lint fixes

* Fix CSS styles & clean up code

* Update favicon, title, & description, remove unused boilerplate

* Remove commented-out code & make ethnicity an array

* frontend progress; todo: add user auth on frontend, pass in array of VSR ids on frontend

* added auth check and passing multiple ids; -todo: server call for delete route is not working, test and fix

* Minor fixes to VSR fields & individual view

* remove unused code, clean up CSS & fix accordion spelling

* delete vsr works; todo: integrate with popup feature

* Scaffolding for updateVSR backend

* Refactor/rename code for consistency

* cleaning up for pr

* Clean up CSS & integrate w/ backend

* Add missing MUI dependency

* Minor CSS touch-ups

* Re-organize frontend components

* Remove package.json from root directory

* Fix frontend compile errors

* Added button functionality to swap

* Rereferencing commits

* Resolving Merges

* Pre-dev hour changes

* WIP edit VSR

* Fix bug with text input field

* Implement roles/permissions checking on backend w/ unit tests

* Add context for current user state, with redirection

* Move backend testUtils to fix testing issues

* Add component for error page, with 404 & 500 pages

* Add success & error UIs for VSR form

* Add success & error messages for VSR actions and login/logout

* Implement loading UI

* Integrate delete VSR feature w/ frontend, including loading, success, & error handling

* Remove dummy page and clean up home page redirection

* Fix linter warning

* Add Vercel config file for backend deployment

* Fix backend server file

* Fix TS imports for backend deployment

* Fix backend Vercel deployment w/ dist

* Integrate email notifications into VSR submission

* Add documentation comments

* Add permission verification & testing for update VSR route

* Finish implementing edit VSR feature

* Fix import errors and address code quality check in comments

* Fix MUI CSS issues with deployment (I hope)

* Add new backend build for Vercel deployment

* Fix styling issues with chip component

* Fix minor bugs

* Add Complete status for VSRs

* Fix 404 handling on VSR individual page

* Add PAP logo to veteran confirmation email template

* Make PAP email address underlined link on VSR page

* Fix title font size on VSR page

* Fix dropdown input scrolling on VSR form page

* Fix error messages for VSR inputs

* Fix text field widths for children inputs on VSR form

* Scroll to top of screen when switching pages on VSR form

* Reorder VSR status options

* Fix spacing on furniture item tags

* Order furniture items correctly

* Make VSR table blue background full height

* remove Case ID from VSR table

* Fix bug on VSR form where pressing enter goes back to previous page

* Better email validation on VSR form + add confirm email field

* Fix blue outline around VSR table cell when clicked

* Fix glitchy accordion transitions on VSR individual page

* Fix status shifting on VSR individual page

* Fix border around buttons, refactor to common button component, make edit VSR button outlined

* Add dismiss option to VSR update status notification

* Fix issues with login page

* Add input validation & error messages for editing VSR

* Re-build backend for deployment

* Fix PAP logo image in VSR confirmation emails

* Make blue background full page on VSR individual page

---------

Co-authored-by: Syu125 <[email protected]>
Co-authored-by: 2s2e <[email protected]>
Co-authored-by: Yoto Kim <[email protected]>
Co-authored-by: sydneyzhang18 <[email protected]>
Co-authored-by: benjaminjohnson2204 <[email protected]>
Co-authored-by: Harsh Gurnani <[email protected]>
Co-authored-by: Harsh Gurnani <[email protected]>
Co-authored-by: SB1019 <[email protected]>
  • Loading branch information
9 people authored Apr 7, 2024
1 parent 488de7d commit 2dd3ca8
Show file tree
Hide file tree
Showing 172 changed files with 7,047 additions and 1,702 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
Expand Down Expand Up @@ -131,3 +130,4 @@ dist

# Miscellaneous
.DS_Store
.vercel
74 changes: 0 additions & 74 deletions backend/__tests__/exampleTest.test.ts

This file was deleted.

49 changes: 49 additions & 0 deletions backend/__tests__/furnitureItemTest.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import request from "supertest";

import app from "src/app";
import { mongoMemoryHooks } from "src/tests/testUtils";
import FurnitureItemModel from "src/models/furnitureItem";

describe("Furniture Item Tests", () => {
mongoMemoryHooks();

it("GET api/furnitureItems returns all available furniture items", async () => {
// Create a few testing furniture items and ensure they can be retrieved
await FurnitureItemModel.create(
{
category: "Bedroom",
name: "Table",
allowMultiple: false,
categoryIndex: 1,
},
{
category: "Bedroom",
name: "Rug",
allowMultiple: false,
categoryIndex: 2,
},
{
category: "Bathroom",
name: "Wash Cloth(s)",
allowMultiple: true,
categoryIndex: 2,
},
{
category: "Bathroom",
name: "Towel(s)",
allowMultiple: true,
categoryIndex: 1,
},
);

const res = await request(app).get("/api/furnitureItems");
expect(res.statusCode).toBe(200);
expect(res.body.length).toBe(4);

// Should be ordered by allowMultiple (desc), then categoryIndex (asc)
expect(res.body[0].name).toBe("Towel(s)");
expect(res.body[1].name).toBe("Wash Cloth(s)");
expect(res.body[2].name).toBe("Table");
expect(res.body[3].name).toBe("Rug");
});
});
40 changes: 40 additions & 0 deletions backend/__tests__/userTest.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import request from "supertest";

import app from "src/app";
import { getTestUserToken, mongoMemoryHooks } from "src/tests/testUtils";
import UserModel, { UserRole } from "src/models/user";
import { firebaseAuth } from "src/services/firebase";
import env from "src/util/validateEnv";

describe("User Tests", () => {
mongoMemoryHooks();

it("GET /api/user/whoami returns 401 when no token is provided", async () => {
const res = await request(app).get("/api/user/whoami");
expect(res.statusCode).toBe(401);
});

it("GET /api/user/whoami returns 401 when an invalid token is provided", async () => {
const res = await request(app)
.get("/api/user/whoami")
.set("Authorization", "Bearer invalidtoken");
expect(res.statusCode).toBe(401);
});

it("GET /api/user/whoami returns current user when a valid token is provided", async () => {
const userInfo = await firebaseAuth.getUserByEmail(env.EMAIL_USER);
const testUser = await UserModel.create({
role: UserRole.STAFF,
uid: userInfo.uid,
});
const testToken = await getTestUserToken();

const res = await request(app)
.get("/api/user/whoami")
.set("Authorization", `Bearer ${testToken}`);
expect(res.statusCode).toBe(200);
expect(res.body.uid).toBe(userInfo.uid);
expect(res.body.role).toBe(UserRole.STAFF);
expect(res.body._id).toBe(testUser._id.toString());
});
});
Loading

0 comments on commit 2dd3ca8

Please sign in to comment.