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 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 recommendation
      professorEmail - the email of the professor receiving the request
      explanation - explanation of what the recommendation is for
      dateRequested - the date and time the recommendation was requested
      dateNeeded - the date and time by which the recommendation is needed
      done - whether the recommendation request has been completed
      Returns:
      the saved RecommendationRequest
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException