-
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: 컨트롤러 메서드와 Swagger 문서 추가 * test: 저장한 레시피 조회 인수테스트 추가 * feat: 저장한 레시피 조회 API 요청에 필요한 기능 추가 인수 테스트만 정상적으로 실행될 수 있도록만 추가 서비스 메서드는 이후에 작성 * test: 인수 테스트에 부족한 조건 추가 * feat: 저장된 꿀조합 목록 조회 서비스 로직 및 테스트 추가 * test: 북마크한 레시피 목록 조회 리포지토리 테스트 추가 * style: 코드 포맷 수정
- Loading branch information
Showing
15 changed files
with
438 additions
and
26 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
src/main/java/com/funeat/member/dto/MemberBookmarkRecipeDto.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 com.funeat.member.dto; | ||
|
||
import com.funeat.product.domain.Product; | ||
import com.funeat.recipe.domain.Recipe; | ||
import com.funeat.recipe.domain.RecipeImage; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
|
||
public record MemberBookmarkRecipeDto( | ||
Long id, | ||
String title, | ||
String image, | ||
String content, | ||
Boolean favorite, | ||
MemberResponse author, | ||
MemberBookmarkRecipeProductsDto products, | ||
LocalDateTime createdAt | ||
) { | ||
|
||
private MemberBookmarkRecipeDto(final Long id, final String title, final String content, final Boolean favorite, | ||
final MemberResponse author, final MemberBookmarkRecipeProductsDto products, | ||
final LocalDateTime createdAt) { | ||
this(id, title, null, content, favorite, author, products, createdAt); | ||
} | ||
|
||
public static MemberBookmarkRecipeDto toDto(final Recipe recipe, final List<RecipeImage> findRecipeImages, | ||
final List<Product> recipeInProducts, final Boolean isFavorite) { | ||
final MemberResponse author = MemberResponse.toResponse(recipe.getMember()); | ||
final MemberBookmarkRecipeProductsDto products = MemberBookmarkRecipeProductsDto.toDto(recipeInProducts); | ||
|
||
if (findRecipeImages.isEmpty()) { | ||
return new MemberBookmarkRecipeDto(recipe.getId(), recipe.getTitle(), recipe.getContent(), isFavorite, | ||
author, products, recipe.getCreatedAt() | ||
); | ||
} | ||
return new MemberBookmarkRecipeDto(recipe.getId(), recipe.getTitle(), findRecipeImages.get(0).getImage(), | ||
recipe.getContent(), isFavorite, author, products, recipe.getCreatedAt() | ||
); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/com/funeat/member/dto/MemberBookmarkRecipeProductDto.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,17 @@ | ||
package com.funeat.member.dto; | ||
|
||
import com.funeat.product.domain.Product; | ||
|
||
public record MemberBookmarkRecipeProductDto( | ||
Long id, | ||
String name, | ||
Long price, | ||
String image, | ||
Double averageRating | ||
) { | ||
|
||
public static MemberBookmarkRecipeProductDto toDto(final Product product) { | ||
return new MemberBookmarkRecipeProductDto(product.getId(), product.getName(), product.getPrice(), | ||
product.getImage(), product.getAverageRating()); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/com/funeat/member/dto/MemberBookmarkRecipeProductsDto.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,18 @@ | ||
package com.funeat.member.dto; | ||
|
||
import com.funeat.product.domain.Product; | ||
|
||
import java.util.List; | ||
|
||
public record MemberBookmarkRecipeProductsDto( | ||
List<MemberBookmarkRecipeProductDto> products | ||
) { | ||
|
||
public static MemberBookmarkRecipeProductsDto toDto(final List<Product> recipeInProducts) { | ||
final List<MemberBookmarkRecipeProductDto> products = recipeInProducts.stream() | ||
.map(MemberBookmarkRecipeProductDto::toDto) | ||
.toList(); | ||
|
||
return new MemberBookmarkRecipeProductsDto(products); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/com/funeat/member/dto/MemberBookmarkRecipesResponse.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,16 @@ | ||
package com.funeat.member.dto; | ||
|
||
import com.funeat.common.dto.PageDto; | ||
|
||
import java.util.List; | ||
|
||
public record MemberBookmarkRecipesResponse( | ||
PageDto page, | ||
List<MemberBookmarkRecipeDto> recipes | ||
) { | ||
|
||
public static MemberBookmarkRecipesResponse toResponse(final PageDto page, | ||
final List<MemberBookmarkRecipeDto> recipes) { | ||
return new MemberBookmarkRecipesResponse(page, recipes); | ||
} | ||
} |
26 changes: 0 additions & 26 deletions
26
src/main/java/com/funeat/member/dto/MemberRecipeProductDto.java
This file was deleted.
Oops, something went wrong.
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
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.