File tree Expand file tree Collapse file tree
yechef/src/main/java/sejong/capston/yechef/domain/Recipe Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ public ResponseEntity<Void> deleteRecipe(
6969
7070 // 공개 목록 조회
7171 @ GetMapping ("/public" )
72- public ResponseEntity <List <Recipe >> getPublicRecipes () {
72+ public ResponseEntity <List <RecipeDto >> getPublicRecipes () {
7373 return ResponseEntity .ok (recipeService .getPublicRecipes ());
7474 }
7575}
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ public class RecipeDto {
1313 private String title ;
1414 private String author ;
1515 private Recipe .RecipeType recipeType ;
16+ private String text ;
1617 private int likeCount ;
1718 private String thumbnailImageUrl ;
1819 private String sourceImageUrl ;
@@ -25,6 +26,7 @@ public static RecipeDto from(Recipe recipe) {
2526 .author (recipe .getAuthor ())
2627 .recipeType (recipe .getRecipeType ())
2728 .likeCount (recipe .getLikeCount ())
29+ .text (recipe .getText ())
2830 .thumbnailImageUrl (recipe .getThumbnailImage () != null ? recipe .getThumbnailImage ().getS3Url () : null )
2931 .sourceImageUrl (recipe .getSourceImage () != null ? recipe .getSourceImage ().getS3Url () : null )
3032 .build ();
Original file line number Diff line number Diff line change @@ -137,8 +137,12 @@ public List<RecipeDto> getLikedRecipes(Long memberId) {
137137 return likedRecipes .stream ().map (RecipeDto ::from ).collect (Collectors .toList ());
138138 }
139139
140- public List <Recipe > getPublicRecipes () {
141- return recipeRepository .findByRecipeType (Recipe .RecipeType .PUBLIC );
140+ public List <RecipeDto > getPublicRecipes () {
141+ return recipeRepository
142+ .findByRecipeType (Recipe .RecipeType .PUBLIC )
143+ .stream ()
144+ .map (RecipeDto ::from )
145+ .collect (Collectors .toList ());
142146 }
143147
144148 @ Transactional (readOnly = true )
You can’t perform that action at this time.
0 commit comments