-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMatchingController.java
More file actions
42 lines (35 loc) · 1.77 KB
/
MatchingController.java
File metadata and controls
42 lines (35 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package com.example.silverbridgeX_user.matching.controller;
import com.example.silverbridgeX_user.global.api_payload.ApiResponse;
import com.example.silverbridgeX_user.global.api_payload.SuccessCode;
import com.example.silverbridgeX_user.matching.service.MatchingService;
import com.example.silverbridgeX_user.user.domain.User;
import com.example.silverbridgeX_user.user.jwt.CustomUserDetails;
import com.example.silverbridgeX_user.user.service.UserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import lombok.RequiredArgsConstructor;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequiredArgsConstructor
@Validated
@RequestMapping("/match/requests")
public class MatchingController {
private final UserService userService;
private final MatchingService matchingService;
@Operation(summary = "매치 신청", description = "매치를 신청받는 메서드입니다.")
@ApiResponses(value = {
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "MATCH_REQUEST_2001", description = "매치 신청이 완료되었습니다.")
})
@PostMapping("")
public ApiResponse<Boolean> matchRequest(
@AuthenticationPrincipal CustomUserDetails customUserDetails
) {
User user = userService.findByUserName(customUserDetails.getUsername());
matchingService.saveMatchRequest(user);
return ApiResponse.onSuccess(SuccessCode.MATCH_REQUEST_SUCCESS, true);
}
}