this is a test dw
This commit is contained in:
@ -118,26 +118,4 @@ public class CurriculumController {
|
||||
curriculumServ.delete(toDelete);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/externalcurriculum/{inscriptionRequestId}")
|
||||
public ResponseEntity<Map<String,Object>> getInscriptionRequestExternalCurriculum(@RequestHeader("Authorization") String token, @PathVariable long inscriptionRequestId){
|
||||
if (authServ.isNotIn(new Role[]{Role.Secretary,Role.Admin, Role.Teacher},token))
|
||||
return new UnauthorizedResponse<>(null);
|
||||
|
||||
HashMap<String,Object> toReturn = userCurriculumServ.findAllExternalCurriculumByInscriptionRequestId(inscriptionRequestId);
|
||||
|
||||
if (toReturn == null)
|
||||
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
|
||||
|
||||
return new ResponseEntity<>(toReturn,HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
//Note : everyone can post some externalcurriculums (the validity of the elements is assured by the inscription service)
|
||||
@PostMapping("/externalcurriculum")
|
||||
public ResponseEntity<ExternalCurriculum> postExternalCurriculum(@RequestBody ExternalCurriculum ec){
|
||||
ec.setState(RequestState.Pending);
|
||||
return new ResponseEntity<>(ecr.save(ec), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -49,28 +49,4 @@ public class UserCurriculumService {
|
||||
}
|
||||
|
||||
|
||||
public HashMap<String,Object> findAllExternalCurriculumByInscriptionRequestId(Long id) {
|
||||
ArrayList<ExternalCurriculum> list = externalCurriculumRepo.getExternalCurriculumByInscriptionRequestId(id);
|
||||
|
||||
ArrayList<HashMap<String, Object>> externalCurriculumList = new ArrayList<HashMap<String, Object>>();
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
HashMap<String, Object> element = new HashMap<>();
|
||||
element.put("id", list.get(0).getId());
|
||||
element.put("inscriptionRequestId", list.get(0).getInscriptionRequestId());
|
||||
element.put("school", list.get(0).getSchool());
|
||||
element.put("formation", list.get(0).getFormation());
|
||||
element.put("completion", list.get(0).getCompletion());
|
||||
element.put("startYear", list.get(0).getStartYear());
|
||||
element.put("endYear", list.get(0).getEndYear());
|
||||
element.put("justifDocUrl", list.get(0).getJustifdocUrl());
|
||||
element.put("state", list.get(0).getState());
|
||||
externalCurriculumList.add(element);
|
||||
}
|
||||
|
||||
HashMap<String, Object> toReturn = new HashMap<String, Object>();
|
||||
toReturn.put("externalCurriculumList", externalCurriculumList);
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -10,7 +10,9 @@ public class ExternalCurriculum {
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private int id;
|
||||
|
||||
private Long inscriptionRequestId;
|
||||
@ManyToOne(fetch = FetchType.EAGER)
|
||||
@JoinColumn(name="InscriptionRequest")
|
||||
private InscriptionRequest inscriptionRequest;
|
||||
|
||||
private String school;
|
||||
|
||||
@ -28,8 +30,8 @@ public class ExternalCurriculum {
|
||||
|
||||
public ExternalCurriculum(){}
|
||||
|
||||
public ExternalCurriculum(Long ir, String school, String formation, String completion, int startYear, int endYear, String justifdocUrl, RequestState state){
|
||||
this.inscriptionRequestId = ir;
|
||||
public ExternalCurriculum(InscriptionRequest ir, String school, String formation, String completion, int startYear, int endYear, String justifdocUrl, RequestState state){
|
||||
this.inscriptionRequest = ir;
|
||||
this.school = school;
|
||||
this.formation = formation;
|
||||
this.completion = completion;
|
||||
@ -43,12 +45,12 @@ public class ExternalCurriculum {
|
||||
return id;
|
||||
}
|
||||
|
||||
public Long getInscriptionRequestId() {
|
||||
return inscriptionRequestId;
|
||||
public InscriptionRequest getInscriptionRequest() {
|
||||
return inscriptionRequest;
|
||||
}
|
||||
|
||||
public void setInscriptionRequest(Long inscriptionRequestId) {
|
||||
this.inscriptionRequestId = inscriptionRequestId;
|
||||
public void setInscriptionRequest(InscriptionRequest inscriptionRequest) {
|
||||
this.inscriptionRequest = inscriptionRequest;
|
||||
}
|
||||
|
||||
public String getSchool() {
|
||||
|
Reference in New Issue
Block a user