|
1 | 1 | package com.loopers.application.api.user; |
2 | 2 |
|
3 | 3 | import com.loopers.application.api.common.dto.ApiResponse; |
| 4 | +import com.loopers.core.domain.user.User; |
| 5 | +import com.loopers.core.service.user.JoinUserService; |
4 | 6 | import lombok.RequiredArgsConstructor; |
5 | | -import org.springframework.web.bind.annotation.GetMapping; |
6 | | -import org.springframework.web.bind.annotation.PathVariable; |
| 7 | +import org.springframework.web.bind.annotation.PostMapping; |
| 8 | +import org.springframework.web.bind.annotation.RequestBody; |
7 | 9 | import org.springframework.web.bind.annotation.RequestMapping; |
8 | 10 | import org.springframework.web.bind.annotation.RestController; |
9 | 11 |
|
10 | | -@RequiredArgsConstructor |
| 12 | +import static com.loopers.application.api.user.UserV1Dto.JoinUserRequest; |
| 13 | +import static com.loopers.application.api.user.UserV1Dto.JoinUserResponse; |
| 14 | + |
11 | 15 | @RestController |
| 16 | +@RequiredArgsConstructor |
12 | 17 | @RequestMapping("/api/v1/users") |
13 | 18 | public class UserV1Controller implements UserV1ApiSpec { |
14 | 19 |
|
15 | | - @GetMapping("/{userId}") |
| 20 | + private final JoinUserService joinUserService; |
| 21 | + |
16 | 22 | @Override |
17 | | - public ApiResponse<UserV1Dto.GetUserResponse> getUser( |
18 | | - @PathVariable(value = "userId") Long userId |
| 23 | + @PostMapping("/join") |
| 24 | + public ApiResponse<JoinUserResponse> joinUser( |
| 25 | + @RequestBody JoinUserRequest request |
19 | 26 | ) { |
20 | | - return ApiResponse.success(null); |
| 27 | + User user = joinUserService.joinUser(request.toCommand()); |
| 28 | + |
| 29 | + return ApiResponse.success(JoinUserResponse.from(user)); |
21 | 30 | } |
22 | 31 | } |
0 commit comments