From 115c050e5ef77261f276f04a9fa37f3c2f613073 Mon Sep 17 00:00:00 2001 From: Bartha Maxime <231026@umons.ac.be> Date: Sat, 16 Mar 2024 15:37:59 +0100 Subject: [PATCH] master merge --- .../Clyde/EndPoints/CurriculumController.java | 14 ++++++++++++++ .../herisson/Clyde/EndPoints/LoginController.java | 2 +- .../herisson/Clyde/EndPoints/MockController.java | 8 ++++---- .../java/ovh/herisson/Clyde/Tables/Course.java | 12 +----------- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/CurriculumController.java b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/CurriculumController.java index 8e9b256..1892d6c 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/CurriculumController.java +++ b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/CurriculumController.java @@ -15,6 +15,7 @@ import ovh.herisson.Clyde.Tables.User; import java.util.Map; @RestController +@CrossOrigin(originPatterns = "*", allowCredentials = "true") public class CurriculumController { @@ -43,4 +44,17 @@ public class CurriculumController { public ResponseEntity> findAll(){ return new ResponseEntity<>(curriculumCourseServ.findAll(),HttpStatus.OK); } + + /**@PostMapping("/curriculum") //todo now + public ResponseEntity postCurriculum(@RequestHeader("Authorization") String token,@RequestBody Curriculum curriculum){ + + if (!isSecretaryOrAdmin(token)){ + return new UnauthorizedResponse<>("you're not allowed to post a Curriculum"); + } + + CurriculumServ.save(Curriculum); + + return new ResponseEntity<>("created !",HttpStatus.CREATED); + }**/ + } diff --git a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/LoginController.java b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/LoginController.java index 1e761ec..2be125d 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/LoginController.java +++ b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/LoginController.java @@ -47,6 +47,6 @@ public class LoginController { @PostMapping("/request/register") public ResponseEntity register(@RequestBody InscriptionRequest inscriptionRequest){ authServ.register(inscriptionRequest); - return new ResponseEntity<>("Is OK", HttpStatus.OK); + return new ResponseEntity<>("Is OK", HttpStatus.CREATED); } } 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 608a450..8136331 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/MockController.java +++ b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/MockController.java @@ -68,10 +68,10 @@ public class MockController { curriculumService.save(psychologyBab1); - Course progra1 = new Course(5,"Programmation et algorithimque 1","TODO DELETE"); - Course chemistry1 = new Course(12, "Thermochimie","TODO DELETE"); - Course psycho1 = new Course(21, "rien faire t'as cru c'est psycho", "TODO DELETE"); - Course commun = new Course(2, "cours commun","TODO DELETE"); + Course progra1 = new Course(5,"Programmation et algorithimque 1"); + Course chemistry1 = new Course(12, "Thermochimie"); + Course psycho1 = new Course(21, "rien faire t'as cru c'est psycho"); + Course commun = new Course(2, "cours commun"); courseService.save(progra1); courseService.save(chemistry1); diff --git a/backend/src/main/java/ovh/herisson/Clyde/Tables/Course.java b/backend/src/main/java/ovh/herisson/Clyde/Tables/Course.java index 54e167a..16d8a79 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Tables/Course.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Tables/Course.java @@ -12,12 +12,10 @@ public class Course { private int courseID; private int credits; private String title; - private String faculty; - public Course(int credits, String title, String faculty){ + public Course(int credits, String title){ this.credits = credits; this.title = title; - this.faculty = faculty; } public Course() {} @@ -34,14 +32,6 @@ public class Course { this.credits = credits; } - public String getFaculty() { - return faculty; - } - - public void setFaculty(String faculty){ - this.faculty = faculty; - } - public String getTitle() { return title; }