Class RecommendationRequestsController

java.lang.Object
edu.ucsb.cs156.example.controllers.ApiController
edu.ucsb.cs156.example.controllers.RecommendationRequestsController

@RequestMapping("/api/recommendationrequests") @RestController public class RecommendationRequestsController extends ApiController
This is a REST controller for RecommendationRequests
  • Constructor Details

    • RecommendationRequestsController

      public RecommendationRequestsController()
  • Method Details

    • allRecommendationRequests

      @PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("/all") public Iterable<RecommendationRequest> allRecommendationRequests()
      List all Recommendation Requests
      Returns:
      an iterable of RecommendationRequests
    • 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 recommendation request
      Parameters:
      requesterEmail - the email of the requester
      professorEmail - the email of the professor
      explanation - an explanation of the request
      dateRequested - the date of the request
      dateNeeded - the date the request is needed by
      done - the status of the request
      Returns:
      the saved recommendationRequest
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • getById

      @PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("") public RecommendationRequest getById(@RequestParam Long id)
      Get a single recommendation request by id
      Parameters:
      id - the id of the recommendation request
      Returns:
      a RecommendationRequest
    • updateRecommendationRequest

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("") public RecommendationRequest updateRecommendationRequest(@RequestParam Long id, @RequestBody @Valid @Valid RecommendationRequest incoming)
      Update a single recommendationrequest
      Parameters:
      id - id of the recommendationrequest to update
      incoming - the new recommendationrequest
      Returns:
      the updated recommendationrequest object
    • deleteRecommendationRequest

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("") public Object deleteRecommendationRequest(@RequestParam Long id)
      Delete a RecommendationRequest
      Parameters:
      id - the id of the recommendationrequest to delete
      Returns:
      a message indicating the recommendationrequest was deleted