Skip to content

Commit 93e9eba

Browse files
authored
refactor: 옷 목록 조회 API response에 카테고리 필드 추가 (#232)
1 parent 2733a0a commit 93e9eba

3 files changed

Lines changed: 16 additions & 4 deletions

File tree

clokey-api/src/main/java/org/clokey/domain/cloth/dto/response/ClothListResponse.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ public record ClothListResponse(
66
@Schema(description = "옷 ID", example = "1") Long clothId,
77
@Schema(description = "옷 이미지 url", example = "https://example.jpg") String ImageUrl,
88
@Schema(description = "옷 브랜드 이름", example = "나이키") String brand,
9-
@Schema(description = "옷 이름", example = "파란색 후드") String name) {}
9+
@Schema(description = "옷 이름", example = "파란색 후드") String name,
10+
@Schema(description = "옷 카테고리", example = "후드티") String category) {}

clokey-api/src/main/java/org/clokey/domain/cloth/repository/ClothRepositoryImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ public Slice<ClothListResponse> findAllMemberClothesByCategoriesAndSeasons(
8989
cloth.id,
9090
cloth.clothImageUrl,
9191
cloth.brand,
92-
cloth.name))
92+
cloth.name,
93+
cloth.category.name))
9394
.from(cloth)
9495
.where(
9596
cloth.member.id.eq(memberId),

clokey-api/src/test/java/org/clokey/domain/cloth/controller/ClothControllerTest.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,18 @@ class 옷_목록_조회_요청_시 {
363363
// given
364364
List<ClothListResponse> clothListResponses =
365365
List.of(
366-
new ClothListResponse(1L, "testImageUrl1", "testBrand1", "testName1"),
367-
new ClothListResponse(2L, "testImageUrl2", "testBrand2", "testName2"));
366+
new ClothListResponse(
367+
1L,
368+
"testImageUrl1",
369+
"testBrand1",
370+
"testName1",
371+
"testCategory1"),
372+
new ClothListResponse(
373+
2L,
374+
"testImageUrl2",
375+
"testBrand2",
376+
"testName2",
377+
"testCategory2"));
368378

369379
given(clothService.getClothes(null, 2, SortDirection.ASC, 1L, List.of(Season.SPRING)))
370380
.willReturn(new SliceResponse<>(clothListResponses, true));

0 commit comments

Comments
 (0)