Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/mraysu/add students backend #57

Closed
wants to merge 9 commits into from

Conversation

mraysu
Copy link
Contributor

@mraysu mraysu commented Feb 14, 2024

Tracking Info

Resolves #17

Changes

  • Added requests for creating students to the frontend api. Students can now be added to the database via the webpage frontend
  • Modified CRUD routes to require a base URL stored in .env, as well as allowed for CORS access between frontend and backend. To test, add the following environmental variables
    • FRONTEND_ORIGIN field in backend/.env (Ex. FRONTEND_ORIGIN = "http://localhost:3000"). Allows for backend to accept requests from the frontend url.
    • NEXT_PUBLIC_API_BASE_URL field in frontend/.env (Ex. NEXT_PUBLIC_API_BASE_URL="http://localhost:4000"). URL prefix for sending requests to the backend
  • Changed so that the form only resets on successful requests rather than every single time

Testing

Tested empty fields, incorrect phone number lengths, invalid emails.

Error messages appear as alerts.

To assist with testing, I would recommend commenting out the reset() function on line 74 of frontend/src/components/StudentFormButton.tsx on the local branch so that the form doesnt reset every time

Confirmation of Change

image

image

Copy link

github-actions bot commented Feb 21, 2024

Visit the preview URL for this PR (updated for commit d7a7aff):

https://pia-dev-60cea--pr57-feature-mraysu-add-s-00a35qul.web.app

(expires Wed, 28 Feb 2024 20:47:32 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: b780ee12a240535f7ca0729d49968573a1f3e284

Copy link
Member

@aaronchan32 aaronchan32 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

} as Student;
}

export async function createStudent(student: StudentData): Promise<APIResult<Student>> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be good to add a check here to make sure that the contact information (email, phone) provided of the emergency contact is different from the contact information (email, phone) of the student

@adhi0331 adhi0331 closed this Mar 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EPIC - Add Students Form
4 participants