Big commit:
make some changes to profile to provide an interface for a student to manage his courses. implements the submission of exemptions request
This commit is contained in:
@ -135,4 +135,5 @@ public class CourseController {
|
||||
courseServ.delete(courseServ.findById(id));
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -120,11 +120,11 @@ public class CurriculumController {
|
||||
}
|
||||
|
||||
@GetMapping("/externalcurriculum/{inscriptionRequestId}")
|
||||
public ResponseEntity<Map<String,Object>> getInscriptionRequestExternalCurriculum(@RequestHeader("Authorization") String token, @PathVariable String 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(Long.parseLong(inscriptionRequestId));
|
||||
HashMap<String,Object> toReturn = userCurriculumServ.findAllExternalCurriculumByInscriptionRequestId(inscriptionRequestId);
|
||||
|
||||
if (toReturn == null)
|
||||
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
|
||||
|
@ -79,6 +79,7 @@ public class MockController {
|
||||
|
||||
ucr.save(new UserCurriculum(joe, infoBab1, 2022));
|
||||
ucr.save(new UserCurriculum(joe, chemistryBab1, 2023));
|
||||
ucr.save(new UserCurriculum(joe, infoBab1, 2023));
|
||||
ucr.save(new UserCurriculum(joe, psychologyBab1, 2020));
|
||||
ucr.save(new UserCurriculum(popo, infoBab1, 2022));
|
||||
ucr.save(new UserCurriculum(popo, infoBab2, 2023));
|
||||
@ -96,7 +97,7 @@ public class MockController {
|
||||
|
||||
CurriculumCourseService.save(new CurriculumCourse(infoBab1,progra1));
|
||||
CurriculumCourseService.save(new CurriculumCourse(infoBab1,commun));
|
||||
|
||||
CurriculumCourseService.save(new CurriculumCourse(infoBab1, psycho1));
|
||||
CurriculumCourseService.save(new CurriculumCourse(psychologyBab1,psycho1));
|
||||
CurriculumCourseService.save(new CurriculumCourse(psychologyBab1,commun));
|
||||
|
||||
|
@ -0,0 +1,32 @@
|
||||
package ovh.herisson.Clyde.EndPoints;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import ovh.herisson.Clyde.Repositories.ExemptionsRequestRepository;
|
||||
import ovh.herisson.Clyde.Tables.ExemptionsRequest;
|
||||
import ovh.herisson.Clyde.Tables.RequestState;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin(originPatterns = "*", allowCredentials = "true")
|
||||
public class RequestsController {
|
||||
|
||||
public final ExemptionsRequestRepository err;
|
||||
|
||||
public RequestsController(ExemptionsRequestRepository err) {
|
||||
this.err = err;
|
||||
}
|
||||
|
||||
@PostMapping(value="/exemptionreq")
|
||||
public ResponseEntity<String> register(@RequestBody ExemptionsRequest exemptionsRequest){
|
||||
|
||||
exemptionsRequest.setState(RequestState.Pending);
|
||||
|
||||
err.save(exemptionsRequest);
|
||||
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package ovh.herisson.Clyde.Repositories;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import ovh.herisson.Clyde.Tables.ExemptionsRequest;
|
||||
|
||||
public interface ExemptionsRequestRepository extends CrudRepository<ExemptionsRequest, Long> {
|
||||
|
||||
}
|
@ -9,21 +9,16 @@ public class ExemptionsRequest {
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private int id;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "Users")
|
||||
private User user;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "Course")
|
||||
private Course course;
|
||||
private long userRegNo;
|
||||
private long courseId;
|
||||
private String justifDocument;
|
||||
|
||||
private RequestState state;
|
||||
|
||||
|
||||
public ExemptionsRequest(User user, Course course, String justifDocument, RequestState state){
|
||||
this.user = user;
|
||||
this.course = course;
|
||||
public ExemptionsRequest(Long userRegNo, long courseId, String justifDocument, RequestState state){
|
||||
this.userRegNo = userRegNo;
|
||||
this.courseId = courseId;
|
||||
this.justifDocument = justifDocument;
|
||||
this.state = state;
|
||||
}
|
||||
@ -31,20 +26,20 @@ public class ExemptionsRequest {
|
||||
|
||||
public ExemptionsRequest(){}
|
||||
|
||||
public User getUser() {
|
||||
return user;
|
||||
public Long getUserRegNo() {
|
||||
return userRegNo;
|
||||
}
|
||||
|
||||
public void setUser(User user) {
|
||||
this.user = user;
|
||||
public void setUserRegNo(Long userRegNo) {
|
||||
this.userRegNo = userRegNo;
|
||||
}
|
||||
|
||||
public Course getCourse() {
|
||||
return course;
|
||||
public long getCourseId() {
|
||||
return courseId;
|
||||
}
|
||||
|
||||
public void setCourse(Course course) {
|
||||
this.course = course;
|
||||
public void setCourseId(long courseId) {
|
||||
this.courseId = courseId;
|
||||
}
|
||||
|
||||
public String getJustifDocument() {
|
||||
|
@ -1,8 +1,7 @@
|
||||
package ovh.herisson.Clyde.Tables;
|
||||
|
||||
public enum FileType {
|
||||
|
||||
ProfilePicture,
|
||||
|
||||
EducationCertificate
|
||||
EducationCertificate,
|
||||
JustificationDocument
|
||||
}
|
||||
|
Reference in New Issue
Block a user