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 RecommendationRequest
  • Constructor Details

    • RecommendationRequestController

      public RecommendationRequestController()
  • Method Details

    • allUCSBRecommendationRequestRepository

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @GetMapping("/all") public Iterable<UCSBRecommendationRequest> allUCSBRecommendationRequestRepository()
      List all UCSB dates
      Returns:
      an iterable of UCSBDate
    • postRecommendationRequest

      @PreAuthorize("hasRole(\'ROLE_USER\')") @PostMapping("/post") public UCSBRecommendationRequest postRecommendationRequest(@RequestParam String requesterEmail, @RequestParam String professorEmail, @RequestParam String explanation, @RequestParam Boolean done, @RequestParam("dateRequested") @DateTimeFormat(iso=DATE_TIME) LocalDateTime dateRequested, @RequestParam("dateNeeded") @DateTimeFormat(iso=DATE_TIME) LocalDateTime dateNeeded) throws com.fasterxml.jackson.core.JsonProcessingException
      Create a new rec
      Parameters:
      requesterEmail - the name of the requestor : string
      professorEmail - the name of the professor : string
      explanation - what the request details : string
      done - the truth value of it being finished or not : bool
      dateRequested - date requestor sent request : iso format, e.g. YYYY-mm-ddTHH:MM:SS
      dateNeeded - date requestor needs request finished by : iso format, e.g. YYYY-mm-ddTHH:MM:SS
      Returns:
      the saved recommendation request
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • getById

      @PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("") public UCSBRecommendationRequest getById(@RequestParam Long id)
      Get a single item on the menu by id
      Parameters:
      id - the id of the menu item
      Returns:
      a menu item
    • updateRecommendationRequest

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("") public UCSBRecommendationRequest updateRecommendationRequest(@RequestParam Long id, @RequestBody @Valid @Valid UCSBRecommendationRequest incoming)
      Update a single recommendation request
      Parameters:
      id - id of the date to update
      incoming - the recommendation request
      Returns:
      the updated recommendation request object
    • deleteUCSBDate

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