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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionList all UCSB datesdeleteUCSBDate
(Long id) Delete a UCSBRecommendationRequestGet a single item on the menu by idpostRecommendationRequest
(String requesterEmail, String professorEmail, String explanation, Boolean done, LocalDateTime dateRequested, LocalDateTime dateNeeded) Create a new recupdateRecommendationRequest
(Long id, @Valid UCSBRecommendationRequest incoming) Update a single recommendation requestMethods inherited from class edu.ucsb.cs156.example.controllers.ApiController
genericMessage, getCurrentUser, handleGenericException
-
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 : stringprofessorEmail
- the name of the professor : stringexplanation
- what the request details : stringdone
- the truth value of it being finished or not : booldateRequested
- date requestor sent request : iso format, e.g. YYYY-mm-ddTHH:MM:SSdateNeeded
- 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 updateincoming
- 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
-