Max/Backend/CoursesEndpoints #129
@ -15,6 +15,7 @@ import ovh.herisson.Clyde.Tables.User;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
|
@CrossOrigin(originPatterns = "*", allowCredentials = "true")
|
||||||
public class CurriculumController {
|
public class CurriculumController {
|
||||||
|
|
||||||
|
|
||||||
@ -43,4 +44,17 @@ public class CurriculumController {
|
|||||||
public ResponseEntity<Iterable<CurriculumCourse>> findAll(){
|
public ResponseEntity<Iterable<CurriculumCourse>> findAll(){
|
||||||
return new ResponseEntity<>(curriculumCourseServ.findAll(),HttpStatus.OK);
|
return new ResponseEntity<>(curriculumCourseServ.findAll(),HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**@PostMapping("/curriculum") //todo now
|
||||||
|
public ResponseEntity<String> 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);
|
||||||
|
}**/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,6 @@ public class LoginController {
|
|||||||
@PostMapping("/request/register")
|
@PostMapping("/request/register")
|
||||||
public ResponseEntity<String> register(@RequestBody InscriptionRequest inscriptionRequest){
|
public ResponseEntity<String> register(@RequestBody InscriptionRequest inscriptionRequest){
|
||||||
authServ.register(inscriptionRequest);
|
authServ.register(inscriptionRequest);
|
||||||
return new ResponseEntity<>("Is OK", HttpStatus.OK);
|
return new ResponseEntity<>("Is OK", HttpStatus.CREATED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,10 +68,10 @@ public class MockController {
|
|||||||
curriculumService.save(psychologyBab1);
|
curriculumService.save(psychologyBab1);
|
||||||
|
|
||||||
|
|
||||||
Course progra1 = new Course(5,"Programmation et algorithimque 1","TODO DELETE");
|
Course progra1 = new Course(5,"Programmation et algorithimque 1");
|
||||||
Course chemistry1 = new Course(12, "Thermochimie","TODO DELETE");
|
Course chemistry1 = new Course(12, "Thermochimie");
|
||||||
Course psycho1 = new Course(21, "rien faire t'as cru c'est psycho", "TODO DELETE");
|
Course psycho1 = new Course(21, "rien faire t'as cru c'est psycho");
|
||||||
Course commun = new Course(2, "cours commun","TODO DELETE");
|
Course commun = new Course(2, "cours commun");
|
||||||
|
|
||||||
courseService.save(progra1);
|
courseService.save(progra1);
|
||||||
courseService.save(chemistry1);
|
courseService.save(chemistry1);
|
||||||
|
@ -12,12 +12,10 @@ public class Course {
|
|||||||
private int courseID;
|
private int courseID;
|
||||||
private int credits;
|
private int credits;
|
||||||
private String title;
|
private String title;
|
||||||
private String faculty;
|
|
||||||
|
|
||||||
public Course(int credits, String title, String faculty){
|
public Course(int credits, String title){
|
||||||
this.credits = credits;
|
this.credits = credits;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.faculty = faculty;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Course() {}
|
public Course() {}
|
||||||
@ -34,14 +32,6 @@ public class Course {
|
|||||||
this.credits = credits;
|
this.credits = credits;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFaculty() {
|
|
||||||
return faculty;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFaculty(String faculty){
|
|
||||||
this.faculty = faculty;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user