diff --git a/backend/docs/StudyPlan.md b/backend/docs/StudyPlan.md index 22bdfef2e85190bcb1aa8a334fc09a1d18a906b8..922072dd6f303a6beaa488932add8e613b327573 100644 --- a/backend/docs/StudyPlan.md +++ b/backend/docs/StudyPlan.md @@ -166,9 +166,18 @@ "status": "FINAL", "notes": "LGTM", "studyPlanCourses": [ - { "courseClassId": "fe9d83cb-26c3-42a9-838a-20d66266e073" }, - { "courseClassId": "9c643f0b-7cdd-4d02-aacd-d33347fdfc0b" }, - { "courseClassId": "606ac4ce-c61e-449c-8728-5953966a787b" } + { + "courseClassId": "22c6c19f-7dab-45c0-8cfc-2d9aa59c1775", + "status": "APPROVED" + }, + { + "courseClassId": "f5b9f49f-be34-4fca-b0da-116990eb515a", + "status": "UNAPPROVED" + }, + { + "courseClassId": "33552c74-bef4-4219-8555-e1de8bc33452", + "status": "UNAPPROVED" + } ] } ``` @@ -177,42 +186,45 @@ ```json { - "id": "ea02c570-811a-4321-bca1-e94088356517", + "id": "10da0a53-6453-4207-9818-3f61d5cd206d", "startYear": 2021, "creditsTotal": 11, "semester": "1", "status": "FINAL", "notes": "LGTM", - "createdAt": "2021-03-15T08:28:35.937Z", - "updatedAt": "2021-03-15T08:28:54.642Z", - "studentId": "694588c4-237b-491e-baa6-0058660381a1", + "createdAt": "2021-03-23T11:24:10.891Z", + "updatedAt": "2021-03-23T11:24:10.891Z", + "studentId": "5f956664-194a-431f-b313-fc7062812f76", "studyPlanCourses": [ { - "id": "cd5ce03d-20e0-4c77-b648-d04cc119b2de", + "id": "10ec462a-201f-4615-879e-fc325ab0e35d", "attendancePercentage": 0, "score": "T", - "createdAt": "2021-03-15T08:39:57.443Z", - "updatedAt": "2021-03-15T08:39:57.443Z", - "courseClassId": "fe9d83cb-26c3-42a9-838a-20d66266e073", - "studyPlanId": "ea02c570-811a-4321-bca1-e94088356517" + "status": "APPROVED", + "createdAt": "2021-03-23T11:32:48.787Z", + "updatedAt": "2021-03-23T11:32:48.787Z", + "courseClassId": "22c6c19f-7dab-45c0-8cfc-2d9aa59c1775", + "studyPlanId": "10da0a53-6453-4207-9818-3f61d5cd206d" }, { - "id": "562e324d-1130-4262-957b-0e89de4fd6c0", + "id": "117d3e69-3ed1-4dbf-9abc-849226e93270", "attendancePercentage": 0, "score": "T", - "createdAt": "2021-03-15T08:39:57.444Z", - "updatedAt": "2021-03-15T08:39:57.444Z", - "courseClassId": "9c643f0b-7cdd-4d02-aacd-d33347fdfc0b", - "studyPlanId": "ea02c570-811a-4321-bca1-e94088356517" + "status": "UNAPPROVED", + "createdAt": "2021-03-23T11:32:48.788Z", + "updatedAt": "2021-03-23T11:32:48.788Z", + "courseClassId": "f5b9f49f-be34-4fca-b0da-116990eb515a", + "studyPlanId": "10da0a53-6453-4207-9818-3f61d5cd206d" }, { - "id": "2113f0f1-bbc8-4378-b53a-383c524a9e07", + "id": "436650d4-d85c-42d4-bf07-134bcf5a9b1b", "attendancePercentage": 0, "score": "T", - "createdAt": "2021-03-15T08:39:57.444Z", - "updatedAt": "2021-03-15T08:39:57.444Z", - "courseClassId": "606ac4ce-c61e-449c-8728-5953966a787b", - "studyPlanId": "ea02c570-811a-4321-bca1-e94088356517" + "status": "UNAPPROVED", + "createdAt": "2021-03-23T11:32:48.788Z", + "updatedAt": "2021-03-23T11:32:48.788Z", + "courseClassId": "33552c74-bef4-4219-8555-e1de8bc33452", + "studyPlanId": "10da0a53-6453-4207-9818-3f61d5cd206d" } ] } diff --git a/backend/src/util/db/study-plan.js b/backend/src/util/db/study-plan.js index ecb069a6b6ea6779f2cbccb91e8c80f36e3c1bc3..75fc4d9da6c85aae6e7767a28fe6e91af21aa7dc 100644 --- a/backend/src/util/db/study-plan.js +++ b/backend/src/util/db/study-plan.js @@ -98,11 +98,15 @@ const deleteAllStudyPlanCourses = async (studyPlanId) => { const recreateAllStudyPlanCourses = async (studyPlanId, studyPlanCourses) => { await studyPlanCourses.forEach(async (course) => { - const { courseClassId } = course; + const { + courseClassId, + status + } = course; await StudyPlanCourse.create({ studyPlanId, - courseClassId + courseClassId, + status }); }); };