Package edu.ucsb.cs156.rec.controllers
Class RecommendationRequestController
java.lang.Object
edu.ucsb.cs156.rec.controllers.ApiController
edu.ucsb.cs156.rec.controllers.RecommendationRequestController
@RequestMapping("/api/recommendationrequest")
@RestController
public class RecommendationRequestController
extends ApiController
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionList all recommendation requestsList all recommendation requests created by a user with requesterIdGet a single request by id CHECK if recommendation request belongs to userpostRecommendationRequest
(Long professorId, String requestType, String details, LocalDateTime neededByDate) Create a new recommendation requestMethods inherited from class edu.ucsb.cs156.rec.controllers.ApiController
genericMessage, getCurrentUser, handleGenericException, handleGenericException
-
Constructor Details
-
RecommendationRequestController
public RecommendationRequestController()
-
-
Method Details
-
allRecommendationRequests
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @GetMapping("/alladmin") public Iterable<RecommendationRequest> allRecommendationRequests()List all recommendation requests- Returns:
- an iterable of RecommendationRequest
-
getAllCurrentUser
@PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("/all") public Iterable<RecommendationRequest> getAllCurrentUser()List all recommendation requests created by a user with requesterId- Returns:
- an iterable of RecommendationRequest
-
postRecommendationRequest
@PreAuthorize("hasRole(\'ROLE_USER\')") @PostMapping("/post") public RecommendationRequest postRecommendationRequest(@RequestParam Long professorId, @RequestParam String requestType, @RequestParam String details, @RequestParam("neededByDate") @DateTimeFormat(iso=DATE_TIME) LocalDateTime neededByDate) throws com.fasterxml.jackson.core.JsonProcessingException Create a new recommendation request- Parameters:
professorId
- the id of the professorrequestType
- the request typedetails
- the details of the recommendation requestneededByDate
- the date the request should be fulfilled by- Returns:
- a RecommendationRequest
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
getById
@PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("") public RecommendationRequest getById(@RequestParam Long id) Get a single request by id CHECK if recommendation request belongs to user- Parameters:
id
- the id of the request- Returns:
- a RecommendationRequest
-