-
Notifications
You must be signed in to change notification settings - Fork 27
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
UserCocktail service, controller를 구현한다. #265
Conversation
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 class UserCocktailResponse { | ||
private String name; | ||
private String description; | ||
private List<UserRecipeItemResponse> userRecipeItemResponses; |
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.
id 값도 넣어서 보내주는건 어떨까용?
전체조회에서 element를 클릭할 경우 상세조회를 할 경우에 필요할듯하네요~
fieldWithPath("userCocktailResponses").type(JsonFieldType.ARRAY).description("나만의 레시피 목록"), | ||
fieldWithPath("userCocktailResponses.[].name").type(JsonFieldType.STRING).description("나만의 레시피 이름"), | ||
fieldWithPath("userCocktailResponses.[].description").type(JsonFieldType.STRING) |
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.
여기도 ID가 들어가겠죠?
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@NoArgsConstructor |
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.
@NoArgsConstructor | |
@NoArgsConstructor(access = AccessLevel.PRIVATE) |
access를 달아줄까용?
public List<UserRecipeItem> toUserRecipeItems(List<Ingredient> ingredients) { | ||
List<UserRecipeItem> userRecipeItems = new ArrayList<>(); | ||
for (int i = 0; i < ingredients.size(); i++) { | ||
userRecipeItems.add(userRecipeItemRequests.get(i).toUserRecipeItem(ingredients.get(i))); |
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.
userRecipeItems.add(userRecipeItemRequests.get(i).toUserRecipeItem(ingredients.get(i))); | |
UserRecipeItem item = userRecipeItemRequests.get(i).toUserRecipeItem(ingredients.get(i)) | |
userRecipeItems.add(item); |
요정도로 수정해서 가독성을 높혀도 좋을듯해요
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@NoArgsConstructor |
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.
@NoArgsConstructor | |
@NoArgsConstructor(access = AccessLevel.PRIVATE) |
😊
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@NoArgsConstructor |
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.
@NoArgsConstructor | |
@NoArgsConstructor(access = AccessLevel.PRIVATE) |
🙂
} | ||
} | ||
|
||
public UserCocktailResponse findUserCocktail(Long id) { |
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.
@transactional(readOnly = true)
붙여주죠!
.orElseThrow(() -> new EntityNotFoundException(ErrorCode.USERCOCKTAIL_NOT_FOUND)); | ||
} | ||
|
||
public UserCocktailResponses findUserCocktails() { |
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.
여기도!
resolve: #262 |
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.
수고했습니다.
프론트에서 컴포넌트명 수정하는건 내가 할게용
void updateUserCocktail() throws Exception { | ||
UserCocktailRequest userCocktailupdateRequest = UserCocktailRequest.builder() | ||
.name("updateUserCocktail") | ||
.description("해피해킹 없이는 살 수 없는 몸이 돼었어") |
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.
?
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.
들켰군
.andExpect(status().isNoContent()) | ||
.andDo(print()) | ||
.andDo(UserCocktailDocumentation.deleteUserCocktail()); | ||
|
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.
공백이 있는데 내가 수정할겡
- QuantityUnit 추가 - 나만의 레시피 권한 관리자 추가 - UserRecipeItemRequest 생성자 Validation 어노테이션 제거
- UserCocktailResponse id 필드 추가 - DTO 빈 생성자 접근 제어자 변경 - Transactional 어노테이션 추가
- 프론트의 amount => quantity, glass => quantity unit
#262
현재 생성, 단일 조회, 전체 조회까지 마쳤습니다.
만들고보니 완성된 아이템의 색상을 만드는 로직이 어디서 들어가야 할 지 논의를 해봐야겠단 생각이 드네요.
오늘 업데이트와 삭제가 완료될 예정입니다.