Package restapi.controllers
Class MatchRequestController
java.lang.Object
restapi.controllers.MatchRequestController
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Logger
private final @NonNull MatchRequestService
private final @NonNull MatchService
private final @NonNull org.springframework.messaging.simp.SimpMessagingTemplate
private final @NonNull UserService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<RestResponse>
postAcceptMatchRequest
(LoggedUser user, long matchId) Accepts the received match request for the given match id if and only if the match request exists and the user is the receiver.org.springframework.http.ResponseEntity<RestResponse>
postCancelMatchRequest
(LoggedUser user, long matchId) Delete a sent match request for the given match id if and only if the user sent it in the first place.org.springframework.http.ResponseEntity<RestResponse>
postSendMatchRequest
(LoggedUser user, long matchId) Send new match request: Creates a match request for the given match id and sends it to contact endpoint /match/send
-
Field Details
-
matchRequestService
-
userService
-
matchService
-
messagingTemplate
@NonNull private final @NonNull org.springframework.messaging.simp.SimpMessagingTemplate messagingTemplate -
logger
-
-
Constructor Details
-
MatchRequestController
public MatchRequestController()
-
-
Method Details
-
postSendMatchRequest
@PostMapping("/send") public org.springframework.http.ResponseEntity<RestResponse> postSendMatchRequest(@AuthenticationPrincipal LoggedUser user, @RequestParam long matchId) Send new match request: Creates a match request for the given match id and sends it to contact endpoint /match/send- Parameters:
user
- Authenticated LoggedUser from tokenmatchId
- Id of match the user wants to start an interaction for- Returns:
- Rest Message OK or Error 404, 409 or 500
-
postCancelMatchRequest
@DeleteMapping("/cancel") public org.springframework.http.ResponseEntity<RestResponse> postCancelMatchRequest(@AuthenticationPrincipal LoggedUser user, @RequestParam long matchId) Delete a sent match request for the given match id if and only if the user sent it in the first place. Then contact gets notified. endpoint /match/cancel- Parameters:
user
- Authenticated LoggedUser from tokenmatchId
- Id of match the user wants to cancel the request for- Returns:
- Rest Message OK or Error 404, 409 or 500
-
postAcceptMatchRequest
@PutMapping("/accept") public org.springframework.http.ResponseEntity<RestResponse> postAcceptMatchRequest(@AuthenticationPrincipal LoggedUser user, @RequestParam long matchId) Accepts the received match request for the given match id if and only if the match request exists and the user is the receiver. Then contact gets notified. endpoint /match/accept- Parameters:
user
- Authenticated LoggedUser from tokenmatchId
- Id of match the user wants to accept the request for- Returns:
- Rest Message OK or Error 404, 409 or 500
-