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

Student and Enrollment Schema modifications #101

Merged
merged 3 commits into from
May 14, 2024

Conversation

parth4apple
Copy link
Member

Changes

  • Updated the student schema and the created an enrollment schema
  • Modified the create, edit, get all student routes to account for these changes

Note on edit student: it takes a list of enrollment objects. When you set _id, it will update the enrollment object with that id. If _id is not set or does not exist, a new enrollment will be made. This allows us to create new enrollments and update existing enrollments at the same time which is needed for the student form

Testing

To get all students (same as before): send a GET to http://localhost:4000/api/student/all

To create a student, send a POST to http://localhost:4000/api/student/create with a body like this:

{
    "student": {
        "lastName": "Doe",
        "firstName": "Johnn",
        "email": "[email protected]",
        "phoneNumber": "8005882300"
    },
    "emergency": {
        "lastName": "Doe",
        "firstName": "John",
        "email": "[email protected]",
        "phoneNumber": "8005882300"
    },
    "serviceCoordinator": {
        "lastName": "Doe",
        "firstName": "John",
        "email": "[email protected]",
        "phoneNumber": "8005882300"
    },
    "location": "HERE",
    "medication": "ADVIL",
    "birthday": "2023-10-01T00:00Z",
    "intakeDate": "2023-10-01T00:00Z",
    "tourDate": "2023-10-01T00:00Z",

    "conservation": true,
    "UCINumber": "1123",
    "incidentForm": "form",
    "documents": [],
    "enrollments": [
        {
            "programId": "66139c986f3731fef83bdb04",
            "status": "Joined",
            "hoursLeft": 8,
            "schedule": ["M", "W", "F"],
            "sessionTime": "9-11am",
            "startDate":  "2023-10-01T00:00Z",
            "renewalDate": "2024-10-01T00:00Z",
            "authNumber": "1238"
        }
    ],
    "dietary": [
        "seafood",
        "dairy"
    ],
    "otherString": "peanuts"
}

To edit the student you created, send a PUT to http://localhost:4000/api/student/edit/${studentId} where studentId is the id of the student you just created.

Replace the _id in enrollments to the id of the enrollment that was created by the previous request in order to actually update it.

{
    "_id": "66399aa7cb9a7ef4b7d91110",
    "student": {
        "lastName": "Doe",
        "firstName": "Jim",
        "email": "[email protected]",
        "phoneNumber": "8005882300"
    },
    "emergency": {
        "lastName": "Doe",
        "firstName": "John",
        "email": "[email protected]",
        "phoneNumber": "8005882300"
    },
    "serviceCoordinator": {
        "lastName": "Doe",
        "firstName": "John",
        "email": "[email protected]",
        "phoneNumber": "8005882300"
    },
    "location": "HERE",
    "medication": "ADVIL",
    "birthday": "2023-10-01T00:00Z",
    "intakeDate": "2023-10-01T00:00Z",
    "tourDate": "2023-10-01T00:00Z",

    "conservation": true,
    "UCINumber": "1123",
    "incidentForm": "form",
    "documents": [],
    "enrollments": [
        {
            "_id": "66399dd478ae8d916ee7024b",
            "programId": "66139c986f3731fef83bdb04",
            "status": "Waitlisted",
            "hoursLeft": 8,
            "schedule": ["M", "W", "F"],
            "sessionTime": "9-11am",
            "startDate":  "2023-10-01T00:00Z",
            "renewalDate": "2024-10-01T00:00Z",
            "authNumber": "1238"
        }
    ],
    "dietary": [
        "seafood",
        "dairy"
    ],
    "otherString": "peanuts"
}

Copy link

github-actions bot commented May 7, 2024

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

https://pia-dev-60cea--pr101-feature-parth4apple-ny6at2pw.web.app

(expires Tue, 14 May 2024 04:04:29 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: b780ee12a240535f7ca0729d49968573a1f3e284

Copy link
Member

@adhi0331 adhi0331 left a comment

Choose a reason for hiding this comment

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

LGTM!!! 🚀

@adhi0331 adhi0331 merged commit e17b509 into main May 14, 2024
4 checks passed
@adhi0331 adhi0331 deleted the feature/parth4apple/enrollments branch May 14, 2024 16:01
aaronchan32 added a commit that referenced this pull request May 20, 2024
commit 0b133b8
Author: Michael Sullivan <[email protected]>
Date:   Tue May 14 09:09:16 2024 -0700

    Feature/mraysu/program form v2 (#100)

    * Update Backend Program Schema

    * V2 UI

    * Disabled Editing Program Type

    * Frontend-backend integration

    * Lint fixes

    ---------

    Co-authored-by: mraysu <[email protected]>
    Co-authored-by: Adhithya Ananthan <[email protected]>

commit e17b509
Author: parth4apple <[email protected]>
Date:   Tue May 14 09:01:15 2024 -0700

    Student and Enrollment Schema modifications (#101)

    * feat: initial schema

    * feat: edit routes

    * feat: test and fix routes
adhi0331 added a commit that referenced this pull request May 21, 2024
* feat: add create program notes backend

* fix: THead unique key prop warning

* feat: add edited by field to notes

* fix: fix styling issues

* feat: add edit and delete functionality to progress notes and change userId to uid for backend

* fix: fix calendar styling

* feat: add download progress notes functionality using react-pdf

* feat: add mobile responsiveness

* feat: create program context provider shared across Home, Programs, and Notes page

* fix: fix styling to be consistent across pages

* feat: add progress note filtering and add loading spinner to pages

* feat: add account type authorization checks on frontend and backend

* refactor: refactor notes logic and fix styling

* feat: add logic to check for no students and refactor filter

* feat: add shadows using overflow clip

* fix: fix styling for search filter

* fix: fix small style inconsistencies

* fix: update poppins font url to use https

* fix: fix modal close button styling to be more consistent

* fix: fix escape key overriding dialog close

* Squashed commit of the following:

commit 0b133b8
Author: Michael Sullivan <[email protected]>
Date:   Tue May 14 09:09:16 2024 -0700

    Feature/mraysu/program form v2 (#100)

    * Update Backend Program Schema

    * V2 UI

    * Disabled Editing Program Type

    * Frontend-backend integration

    * Lint fixes

    ---------

    Co-authored-by: mraysu <[email protected]>
    Co-authored-by: Adhithya Ananthan <[email protected]>

commit e17b509
Author: parth4apple <[email protected]>
Date:   Tue May 14 09:01:15 2024 -0700

    Student and Enrollment Schema modifications (#101)

    * feat: initial schema

    * feat: edit routes

    * feat: test and fix routes

---------

Co-authored-by: Adhithya Ananthan <[email protected]>
adhi0331 pushed a commit that referenced this pull request Jun 16, 2024
* feat: add create program notes backend

* fix: THead unique key prop warning

* feat: add edited by field to notes

* fix: fix styling issues

* feat: add edit and delete functionality to progress notes and change userId to uid for backend

* fix: fix calendar styling

* feat: add download progress notes functionality using react-pdf

* feat: add mobile responsiveness

* feat: create program context provider shared across Home, Programs, and Notes page

* fix: fix styling to be consistent across pages

* feat: add progress note filtering and add loading spinner to pages

* feat: add account type authorization checks on frontend and backend

* refactor: refactor notes logic and fix styling

* feat: add logic to check for no students and refactor filter

* feat: add shadows using overflow clip

* fix: fix styling for search filter

* fix: fix small style inconsistencies

* fix: update poppins font url to use https

* fix: fix modal close button styling to be more consistent

* fix: fix escape key overriding dialog close

* Squashed commit of the following:

commit 0b133b8
Author: Michael Sullivan <[email protected]>
Date:   Tue May 14 09:09:16 2024 -0700

    Feature/mraysu/program form v2 (#100)

    * Update Backend Program Schema

    * V2 UI

    * Disabled Editing Program Type

    * Frontend-backend integration

    * Lint fixes

    ---------

    Co-authored-by: mraysu <[email protected]>
    Co-authored-by: Adhithya Ananthan <[email protected]>

commit e17b509
Author: parth4apple <[email protected]>
Date:   Tue May 14 09:01:15 2024 -0700

    Student and Enrollment Schema modifications (#101)

    * feat: initial schema

    * feat: edit routes

    * feat: test and fix routes

* feat: add frontend and backend for account archival

* feat: ensure ui updates and refactor code

* Squashed merge with main

* fix: update type of VerifyUser to be same as User

* fix: fix user type error
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.

2 participants