From a9e52d34d42be6d303affb237c75f897ee3182e7 Mon Sep 17 00:00:00 2001 From: LeoMoulin Date: Thu, 18 Apr 2024 21:35:50 +0200 Subject: [PATCH] Start the rework of externalCurriculum interface --- .../ExternalCurriculumController.java | 11 +- .../Clyde/EndPoints/MockController.java | 5 +- .../src/Apps/Inscription/AboutStudent.vue | 2 +- .../Inscription/ExternalCurriculumList.vue | 133 +++++++++++++++--- frontend/src/Apps/Login.vue | 3 +- frontend/src/Apps/Profil.vue | 25 +++- frontend/src/rest/externalCurriculum.js | 9 +- 7 files changed, 156 insertions(+), 32 deletions(-) diff --git a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/Inscription/ExternalCurriculumController.java b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/Inscription/ExternalCurriculumController.java index e88c759..a8a87ce 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/Inscription/ExternalCurriculumController.java +++ b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/Inscription/ExternalCurriculumController.java @@ -30,9 +30,16 @@ public class ExternalCurriculumController { //everyone can post some externalcurriculums (the validity of the elements is assured by the inscription service) @PostMapping("/externalcurriculum") public ResponseEntity postExternalCurriculum(@RequestBody Map externalCurrInfos){ - InscriptionRequest ir = inscriptionRepository.findById((Integer) externalCurrInfos.get("inscriptionRequestId")); + //An external curriculum can either be linked to an User or to an InscriptionRequest + InscriptionRequest ir = null; + User user = null; + if (externalCurrInfos.get("inscriptionRequestId") != null){ + ir = inscriptionRepository.findById((Integer) externalCurrInfos.get("inscriptionRequestId")); + }else{ + user = userRepository.findById((Integer) externalCurrInfos.get("userRegNo")); + } - ExternalCurriculum toSave = new ExternalCurriculum(ir, (String) externalCurrInfos.get("school"),(String) externalCurrInfos.get("formation"),(String) externalCurrInfos.get("completion"), (Integer)externalCurrInfos.get("startYear"), (Integer)externalCurrInfos.get("endYear"), (String)externalCurrInfos.get("justifDocUrl"), null); + ExternalCurriculum toSave = new ExternalCurriculum(ir, (String) externalCurrInfos.get("school"),(String) externalCurrInfos.get("formation"),(String) externalCurrInfos.get("completion"), (Integer)externalCurrInfos.get("startYear"), (Integer)externalCurrInfos.get("endYear"), (String)externalCurrInfos.get("justifDocUrl"), user); return new ResponseEntity<>(ecr.save(toSave), HttpStatus.OK); } 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 3d75d2a..6ff0707 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/MockController.java +++ b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/MockController.java @@ -76,6 +76,9 @@ public class MockController { userService.saveAll(mockUsers); + ExternalCurriculum externalCurriculum = new ExternalCurriculum(null, "HEH", "Bachelier en ingénieur", "completed", 2015, 2017, null, joe); + externalCurriculumRepository.save(externalCurriculum); + Minerval minerval = new Minerval(joe.getRegNo(), 0, 852, 2023); minervalRepository.save(minerval); // Course / Curriculum part @@ -133,7 +136,7 @@ public class MockController { UnregisterRequest unregisterRequest = new UnregisterRequest(RequestState.Pending, "je veux partir", new Date(), joe.getRegNo(), joe.getFirstName(), joe.getLastName(), joe.getEmail(), null); uninscriptionRequestRepository.save(unregisterRequest); - ExternalCurriculum externalCurriculum = new ExternalCurriculum(inscriptionRequest, "HEH", "Bachelier en informatique", "Completed", 2015, 2018, null, null); + externalCurriculum = new ExternalCurriculum(inscriptionRequest, "HEH", "Bachelier en informatique", "Completed", 2015, 2018, null, null); externalCurriculumRepository.save(externalCurriculum); } } diff --git a/frontend/src/Apps/Inscription/AboutStudent.vue b/frontend/src/Apps/Inscription/AboutStudent.vue index 54d81fc..91fb89f 100644 --- a/frontend/src/Apps/Inscription/AboutStudent.vue +++ b/frontend/src/Apps/Inscription/AboutStudent.vue @@ -88,7 +88,7 @@
- +
diff --git a/frontend/src/Apps/Inscription/ExternalCurriculumList.vue b/frontend/src/Apps/Inscription/ExternalCurriculumList.vue index a642840..eba1cdf 100644 --- a/frontend/src/Apps/Inscription/ExternalCurriculumList.vue +++ b/frontend/src/Apps/Inscription/ExternalCurriculumList.vue @@ -1,25 +1,91 @@ diff --git a/frontend/src/Apps/Login.vue b/frontend/src/Apps/Login.vue index dbac9e3..705012f 100644 --- a/frontend/src/Apps/Login.vue +++ b/frontend/src/Apps/Login.vue @@ -100,7 +100,7 @@