Class RecommendationRequestController
java.lang.Object
edu.ucsb.cs156.example.controllers.ApiController
edu.ucsb.cs156.example.controllers.RecommendationRequestController
@RequestMapping("/api/RecommendationRequest")
@RestController
public class RecommendationRequestController
extends ApiController
This is a REST controller for RecommendationRequests
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionList all RecommendationRequestspostRecommendationRequest(String requesterEmail, String professorEmail, String explanation, LocalDateTime dateRequested, LocalDateTime dateNeeded, boolean done) Create a new RecommendationRequestMethods inherited from class edu.ucsb.cs156.example.controllers.ApiController
genericMessage, getCurrentUser, handleGenericException
-
Constructor Details
-
RecommendationRequestController
public RecommendationRequestController()
-
-
Method Details
-
allRecommendationRequests
@PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("/all") public Iterable<RecommendationRequest> allRecommendationRequests()List all RecommendationRequests- Returns:
- an iterable of RecommendationRequest
-
postRecommendationRequest
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public RecommendationRequest postRecommendationRequest(@RequestParam String requesterEmail, @RequestParam String professorEmail, @RequestParam String explanation, @RequestParam("dateRequested") @DateTimeFormat(iso=DATE_TIME) LocalDateTime dateRequested, @RequestParam("dateNeeded") @DateTimeFormat(iso=DATE_TIME) LocalDateTime dateNeeded, @RequestParam boolean done) throws com.fasterxml.jackson.core.JsonProcessingException Create a new RecommendationRequest- Parameters:
requesterEmail- the email of the person requesting the recommendationprofessorEmail- the email of the professor receiving the requestexplanation- explanation of what the recommendation is fordateRequested- the date and time the recommendation was requesteddateNeeded- the date and time by which the recommendation is neededdone- whether the recommendation request has been completed- Returns:
- the saved RecommendationRequest
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-