-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 리액션 API 추가 및 추천리스트 API, 리스트 상세조회 API 재구현 (#304)
* feat: 리액션 API 추가 및 추천리스트 API, 리스트 상세조회 API 재구현 * test: 리액션 관련 테스트 추가 및 이에 따른 변경된 API에 대한 테스트코드 수정 * refactor: 코드리뷰에 의한 네이밍 변경 및 리액션 패키지구조 별도 추출 * refactor: 코드리뷰에 의한 네이밍 변경
- Loading branch information
Showing
23 changed files
with
653 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 0 additions & 33 deletions
33
src/main/java/com/listywave/list/application/dto/response/ListTrandingResponse.java
This file was deleted.
Oops, something went wrong.
54 changes: 54 additions & 0 deletions
54
src/main/java/com/listywave/list/application/dto/response/RecommendedListResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package com.listywave.list.application.dto.response; | ||
|
||
import com.listywave.list.application.domain.item.Item; | ||
import com.listywave.list.application.domain.list.ListEntity; | ||
import lombok.Builder; | ||
|
||
import java.util.List; | ||
|
||
@Builder | ||
public record RecommendedListResponse( | ||
Long id, | ||
Long ownerId, | ||
String ownerNickname, | ||
String title, | ||
String itemImageUrl, | ||
String category, | ||
String backgroundColor, | ||
List<Top3ItemResponse> items | ||
) { | ||
public static RecommendedListResponse of(ListEntity list) { | ||
return RecommendedListResponse.builder() | ||
.id(list.getId()) | ||
.ownerId(list.getUser().getId()) | ||
.ownerNickname(list.getUser().getNickname()) | ||
.title(list.getTitle().getValue()) | ||
.itemImageUrl(list.getRepresentImageUrl()) | ||
.category(list.getCategory().getViewName()) | ||
.backgroundColor(list.getBackgroundColor().name()) | ||
.items(Top3ItemResponse.toList(list.getTop3Items().getValues())) | ||
.build(); | ||
} | ||
|
||
@Builder | ||
public record Top3ItemResponse( | ||
Long id, | ||
int rank, | ||
String title | ||
) { | ||
|
||
public static List<Top3ItemResponse> toList(List<Item> items) { | ||
return items.stream() | ||
.map(Top3ItemResponse::of) | ||
.toList(); | ||
} | ||
|
||
public static Top3ItemResponse of(Item item) { | ||
return Top3ItemResponse.builder() | ||
.id(item.getId()) | ||
.rank(item.getRanking()) | ||
.title(item.getTitle().getValue()) | ||
.build(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.