-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BE] feat: 꿀조합 검색 기능 구현 #477
Conversation
public static SearchRecipeResultDto toDto(final Recipe recipe, final List<RecipeImage> images, | ||
final List<Product> products) { | ||
final List<ProductRecipeDto> productRecipes = products.stream() | ||
.map(ProductRecipeDto::toDto) | ||
.collect(Collectors.toList()); | ||
|
||
if (images.isEmpty()) { | ||
return new SearchRecipeResultDto(recipe.getId(), null, recipe.getTitle(), | ||
RecipeAuthorDto.toDto(recipe.getMember()), productRecipes, recipe.getFavoriteCount(), | ||
recipe.getCreatedAt()); | ||
} | ||
return new SearchRecipeResultDto(recipe.getId(), images.get(0).getImage(), recipe.getTitle(), | ||
RecipeAuthorDto.toDto(recipe.getMember()), productRecipes, recipe.getFavoriteCount(), | ||
recipe.getCreatedAt()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dto 안에서 dto 를 만드는 것은 가독성이 떨어지는 것 같아요
밖에서 dto 를 다 만들어서 애초부터 넣는 방식은 어떻게 생각하시나요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
현재 레시피 패키지안에서
dto를 만드는 정적팩토리메소드는 대체로
도메인(엔티티)을 파라미터로 받아 dto를 만들고 있습니다.
저는 개인적으로 밖에서 dto를 만들면 서비스 코드가 난잡해지는 것 같아요..!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
검색 마스터 맹고~
수고하셨습니다!!
public static SearchRecipeResultDto toDto(final Recipe recipe, final List<RecipeImage> images, | ||
final List<Product> products) { | ||
final List<ProductRecipeDto> productRecipes = products.stream() | ||
.map(ProductRecipeDto::toDto) | ||
.collect(Collectors.toList()); | ||
|
||
if (images.isEmpty()) { | ||
return new SearchRecipeResultDto(recipe.getId(), null, recipe.getTitle(), | ||
RecipeAuthorDto.toDto(recipe.getMember()), productRecipes, recipe.getFavoriteCount(), | ||
recipe.getCreatedAt()); | ||
} | ||
return new SearchRecipeResultDto(recipe.getId(), images.get(0).getImage(), recipe.getTitle(), | ||
RecipeAuthorDto.toDto(recipe.getMember()), productRecipes, recipe.getFavoriteCount(), | ||
recipe.getCreatedAt()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
현재 레시피 패키지안에서
dto를 만드는 정적팩토리메소드는 대체로
도메인(엔티티)을 파라미터로 받아 dto를 만들고 있습니다.
저는 개인적으로 밖에서 dto를 만들면 서비스 코드가 난잡해지는 것 같아요..!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저는 서비스 로직에서 하면 서비스 코드 길어져서 깔끔하게 dto 안에서 하는게 더 나아보여요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다!!
Issue
✨ 구현한 기능
꿀조합 검색 기능 구현
LIKE
연산📢 논의하고 싶은 내용
🎸 기타
⏰ 일정