Klasse RecommendationController
java.lang.Object
com.spaghetticodegang.trylater.recommendation.RecommendationController
@RestController
@RequestMapping("/api/recommendation")
public class RecommendationController
extends Object
REST controller providing endpoints for managing recommendations.
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungorg.springframework.http.ResponseEntity
<RecommendationResponseDto> createRecommendation
(User me, @Valid RecommendationRequestDto request) Handles a new recommendation request by delegating to the service layer.org.springframework.http.ResponseEntity
<Void> deleteRecommendationAssignment
(User me, Long recommendationId) Deletes a recommendation assignment by delegating to the service layer.org.springframework.http.ResponseEntity
<List<RecommendationResponseDto>> getAllRecommendations
(User me, RecommendationAssignmentStatus recommendationAssignmentStatus) Handles request to get all assigned recommendations by delegating to the service layer.org.springframework.http.ResponseEntity
<RecommendationResponseDto> updateRecommendationAssignmentStatus
(User me, Long recommendationId, @Valid RecommendationAssignmentStatusRequestDto recommendationAssignmentStatus) Handles a recommendation assignment status update request by delegating to the service layer.
-
Konstruktordetails
-
RecommendationController
public RecommendationController()
-
-
Methodendetails
-
createRecommendation
@PostMapping public org.springframework.http.ResponseEntity<RecommendationResponseDto> createRecommendation(@AuthenticationPrincipal User me, @RequestBody @Valid @Valid RecommendationRequestDto request) Handles a new recommendation request by delegating to the service layer.- Parameter:
me
- the currently authenticated user (requester)request
- the recommendation request data including receiver user IDs- Gibt zurück:
- the created recommendation as a response DTO
-
updateRecommendationAssignmentStatus
@PatchMapping("/{id}") public org.springframework.http.ResponseEntity<RecommendationResponseDto> updateRecommendationAssignmentStatus(@AuthenticationPrincipal User me, @PathVariable("id") Long recommendationId, @RequestBody @Valid @Valid RecommendationAssignmentStatusRequestDto recommendationAssignmentStatus) Handles a recommendation assignment status update request by delegating to the service layer.- Parameter:
me
- the currently authenticated user (requester)recommendationId
- the ID of the recommendation that assignment to updaterecommendationAssignmentStatus
- the recommendation assignment status- Gibt zurück:
- the created recommendation as a response DTO
-
getAllRecommendations
@GetMapping public org.springframework.http.ResponseEntity<List<RecommendationResponseDto>> getAllRecommendations(@AuthenticationPrincipal User me, @RequestParam(name="status",required=false) RecommendationAssignmentStatus recommendationAssignmentStatus) Handles request to get all assigned recommendations by delegating to the service layer.- Parameter:
me
- the currently authenticated user (requester)recommendationAssignmentStatus
- the status of the assignment- Gibt zurück:
- a list of all the assigned recommendation with that specified status
-
deleteRecommendationAssignment
@DeleteMapping("/{id}") public org.springframework.http.ResponseEntity<Void> deleteRecommendationAssignment(@AuthenticationPrincipal User me, @PathVariable("id") Long recommendationId) Deletes a recommendation assignment by delegating to the service layer.- Parameter:
me
- the currently authenticated user (requester)recommendationId
- the ID of the recommendation that assignment should delete- Gibt zurück:
- A
ResponseEntity
with HTTP status code 204 (NO_CONTENT)
-