Skip to content

Commit 562b1f3

Browse files
committed
feat/ #33 코드 리뷰 반영
1 parent a1da790 commit 562b1f3

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

src/main/java/com/closetnangam/be/domain/wardrobe/controller/WardrobeController.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,39 @@
22

33
import com.closetnangam.be.domain.wardrobe.dto.response.WardrobeResponse;
44
import com.closetnangam.be.domain.wardrobe.service.WardrobeService;
5+
import com.closetnangam.be.global.auth.util.SecurityUtils;
6+
import com.closetnangam.be.global.common.response.ApiResponse;
57
import io.swagger.v3.oas.annotations.Operation;
68
import io.swagger.v3.oas.annotations.tags.Tag;
79
import lombok.RequiredArgsConstructor;
810
import org.springframework.http.HttpStatus;
11+
import org.springframework.http.ResponseEntity;
912
import org.springframework.web.bind.annotation.GetMapping;
1013
import org.springframework.web.bind.annotation.PathVariable;
1114
import org.springframework.web.bind.annotation.PostMapping;
1215
import org.springframework.web.bind.annotation.RequestMapping;
13-
import org.springframework.web.bind.annotation.ResponseStatus;
1416
import org.springframework.web.bind.annotation.RestController;
1517

1618
@Tag(name = "Wardrobe", description = "옷장 API")
1719
@RestController
18-
@RequestMapping("/api/wardrobes")
20+
@RequestMapping("/api/v1/wardrobes")
1921
@RequiredArgsConstructor
2022
public class WardrobeController {
2123

2224
private final WardrobeService wardrobeService;
2325

2426
@Operation(summary = "회원 옷장 조회", description = "회원당 1개의 옷장을 조회합니다.")
2527
@GetMapping("/users/{userId}")
26-
public WardrobeResponse getWardrobeByUserId(@PathVariable Long userId) {
27-
return wardrobeService.getWardrobeByUserId(userId);
28+
public ResponseEntity<ApiResponse<WardrobeResponse>> getWardrobeByUserId(@PathVariable Long userId) {
29+
SecurityUtils.verifyUserIdMatch(userId);
30+
return ResponseEntity.ok(ApiResponse.ok(wardrobeService.getWardrobeByUserId(userId)));
2831
}
2932

3033
@Operation(summary = "회원 옷장 생성", description = "회원 가입 후 옷장을 1회 생성합니다.")
3134
@PostMapping("/users/{userId}")
32-
@ResponseStatus(HttpStatus.CREATED)
33-
public WardrobeResponse createWardrobe(@PathVariable Long userId) {
34-
return wardrobeService.createWardrobe(userId);
35+
public ResponseEntity<ApiResponse<WardrobeResponse>> createWardrobe(@PathVariable Long userId) {
36+
SecurityUtils.verifyUserIdMatch(userId);
37+
return ResponseEntity.status(HttpStatus.CREATED)
38+
.body(ApiResponse.ok(wardrobeService.createWardrobe(userId)));
3539
}
3640
}

0 commit comments

Comments
 (0)