From a27cf63daf9b7de35f8154a4c7c3d7d46977cea0 Mon Sep 17 00:00:00 2001 From: LeoMoulin Date: Wed, 17 Apr 2024 21:42:33 +0200 Subject: [PATCH] Add the post feature for differents types of changeCurriculumRequest --- .../Inscription/RequestsController.java | 9 +++- .../Clyde/EndPoints/MockController.java | 3 +- frontend/src/Apps/Profil.vue | 52 +++++++++++++++++-- 3 files changed, 59 insertions(+), 5 deletions(-) diff --git a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/Inscription/RequestsController.java b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/Inscription/RequestsController.java index faeefb2..83292ec 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/Inscription/RequestsController.java +++ b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/Inscription/RequestsController.java @@ -179,7 +179,14 @@ public class RequestsController { public ResponseEntity addChangeCurrReq(@RequestBody Map reqInfos){ User user = userRepository.findById((Integer) reqInfos.get("userId")); - Curriculum actualCurriculum = curriculumRepository.findById((Integer) reqInfos.get("actualcursus")); + Curriculum actualCurriculum; + + //If null then it means we are in a supplementary cursus case + if (reqInfos.get("actualcursus") == null){ + actualCurriculum = null; + }else{ + actualCurriculum = curriculumRepository.findById((Integer) reqInfos.get("actualcursus")); + } Curriculum destinationCurriculum = curriculumRepository.findById((Integer) reqInfos.get("newcursus")); diff --git a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/MockController.java b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/MockController.java index 3919597..2181da0 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/MockController.java +++ b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/MockController.java @@ -85,13 +85,14 @@ public class MockController { Curriculum infoBab2 = new Curriculum(2,"info"); Curriculum masterinfo1 = new Curriculum(4, "info"); Curriculum masterinfo2 = new Curriculum(5, "info"); - + Curriculum chemistryBab2 = new Curriculum(2, "chemistry"); curriculumService.save(infoBab1); curriculumService.save(chemistryBab1); curriculumService.save(psychologyBab1); curriculumService.save(infoBab2); curriculumService.save(masterinfo1); curriculumService.save(masterinfo2); + curriculumService.save(chemistryBab2); ucr.save(new UserCurriculum(joe, infoBab1, 2022, false)); ucr.save(new UserCurriculum(joe, chemistryBab1, 2023, true)); diff --git a/frontend/src/Apps/Profil.vue b/frontend/src/Apps/Profil.vue index 7a9fbc0..eb9a80b 100644 --- a/frontend/src/Apps/Profil.vue +++ b/frontend/src/Apps/Profil.vue @@ -1,7 +1,7 @@