Add the exemptions gestion and improve the navigation between requests
This commit is contained in:
		| @ -88,6 +88,28 @@ public class RequestsController { | ||||
|         return new ResponseEntity<>(toReturn, HttpStatus.OK); | ||||
|     } | ||||
|  | ||||
|     @GetMapping(value = "/exemptionsreq/{id}") | ||||
|     public ResponseEntity<ExemptionsRequest> getExemptionRequestbyId(@RequestHeader("Authorization") String token, @PathVariable long id){ | ||||
|         if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary,Role.InscriptionService},token)) | ||||
|             return new UnauthorizedResponse<>(null); | ||||
|  | ||||
|         ExemptionsRequest exemptionsRequest = err.findById(id); | ||||
|  | ||||
|         return new ResponseEntity<>(exemptionsRequest, HttpStatus.OK); | ||||
|     } | ||||
|  | ||||
|     @PatchMapping(value = "/exemptionsreq/{id}/{newstate}") | ||||
|     public ResponseEntity<String> changeExemptionReqState(@RequestHeader("Authorization") String token, @PathVariable long id, @PathVariable RequestState newstate){ | ||||
|         if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary,Role.InscriptionService},token)) | ||||
|             return new UnauthorizedResponse<>(null); | ||||
|  | ||||
|         ExemptionsRequest exemptionsRequest = err.findById(id); | ||||
|         exemptionsRequest.setState(newstate); | ||||
|         err.save(exemptionsRequest); | ||||
|  | ||||
|         return new ResponseEntity<>(HttpStatus.OK); | ||||
|     } | ||||
|  | ||||
|     //Get all the scholarships requests | ||||
|     @GetMapping(value = "/scholarshipreq") | ||||
|     public ResponseEntity<ArrayList<ScholarshipRequest>> getAllScholarshipRequests(@RequestHeader("Authorization") String token){ | ||||
|  | ||||
| @ -4,5 +4,5 @@ import org.springframework.data.repository.CrudRepository; | ||||
| import ovh.herisson.Clyde.Tables.Inscription.ExemptionsRequest; | ||||
|  | ||||
| public interface ExemptionsRequestRepository extends CrudRepository<ExemptionsRequest, Long> { | ||||
|  | ||||
|     ExemptionsRequest findById(long id); | ||||
| } | ||||
|  | ||||
| @ -80,4 +80,8 @@ public class ExemptionsRequest { | ||||
|     public void setDate(Date date) { | ||||
|         this.date = date; | ||||
|     } | ||||
|  | ||||
|     public int getId() { | ||||
|         return id; | ||||
|     } | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user