Class MatchRequestController

java.lang.Object
restapi.controllers.MatchRequestController

@RestController @RequestMapping("/match") public class MatchRequestController extends Object
  • Field Details

    • matchRequestService

      @NonNull private final @NonNull MatchRequestService matchRequestService
    • userService

      @NonNull private final @NonNull UserService userService
    • matchService

      @NonNull private final @NonNull MatchService matchService
    • messagingTemplate

      @NonNull private final @NonNull org.springframework.messaging.simp.SimpMessagingTemplate messagingTemplate
    • logger

      private final Logger 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 token
      matchId - 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 token
      matchId - 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 token
      matchId - Id of match the user wants to accept the request for
      Returns:
      Rest Message OK or Error 404, 409 or 500