-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feat] 족보 공유 관련 API 분리, 시큐리티 whiteList에 추가 (#233)
* [refac] Refactor api path, Add shared favaroite GET api * [feat] Add shared favaroite GET api * [feat] Add businessLogicWhileList path * [feat] Add response dto
- Loading branch information
1 parent
7b5942d
commit 1434169
Showing
4 changed files
with
57 additions
and
3 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
41 changes: 41 additions & 0 deletions
41
...java/org/hankki/hankkiserver/api/favorite/service/response/FavoriteSharedGetResponse.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,41 @@ | ||
package org.hankki.hankkiserver.api.favorite.service.response; | ||
|
||
import static org.hankki.hankkiserver.api.favorite.service.response.util.FavoriteResponseUtil.transformDetail; | ||
|
||
import java.util.List; | ||
import org.hankki.hankkiserver.domain.favorite.model.Favorite; | ||
import org.hankki.hankkiserver.domain.store.model.Store; | ||
|
||
public record FavoriteSharedGetResponse( | ||
String title, | ||
List<String> details, | ||
String nickname, | ||
List<FavoriteSharedResponse> stores | ||
) { | ||
public static FavoriteSharedGetResponse of(final Favorite favorite, final String nickname, final List<Store> stores) { | ||
return new FavoriteSharedGetResponse( | ||
favorite.getName(), | ||
transformDetail(favorite.getDetail()), | ||
nickname, | ||
stores.stream().map(FavoriteSharedResponse::of).toList()); | ||
} | ||
|
||
record FavoriteSharedResponse( | ||
Long id, | ||
String name, | ||
String imageUrl, | ||
String category, | ||
int lowestPrice, | ||
int heartCount | ||
) { | ||
static FavoriteSharedResponse of(final Store store) { | ||
return new FavoriteSharedResponse( | ||
store.getId(), | ||
store.getName(), | ||
store.getImageUrlOrElseNull(), | ||
store.getCategory().getName(), | ||
store.getLowestPrice(), | ||
store.getHeartCount()); | ||
} | ||
} | ||
} |
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