-
Notifications
You must be signed in to change notification settings - Fork 164
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
🚀 2단계 - 리팩터링(메뉴) #225
Open
jordy-torvalds
wants to merge
13
commits into
next-step:jordy-torvalds
Choose a base branch
from
jordy-torvalds:step2
base: jordy-torvalds
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
🚀 2단계 - 리팩터링(메뉴) #225
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
7e635b3
feat: to-be entity 생성
jordy-torvalds d7dcb5a
doc(menuGroup): 요구사항에 이름 부분 수정
jordy-torvalds 2ec3c6b
refactor(menuGroup): 메뉴 그룹 리팩토링
jordy-torvalds 9468aeb
refactor(menuGroup): 패키지 구조 변경
jordy-torvalds a740671
refactor(menuGroup): 기존 구현체 제거 및 tobe 접두사 제거
jordy-torvalds 51089c9
refactor(menu): 메뉴 테스트 리팩토링
jordy-torvalds 66cfe66
refactor(menu): 메뉴 tobe 접두사 제거 및 패키지 제거
jordy-torvalds 693182c
refactor(menu): 가격 검증 최적화
jordy-torvalds 2d0c25a
refactor(menuGroup): 연관관계 끊기
jordy-torvalds 1102fec
feat(quantity): VO 생성
jordy-torvalds aae4bd0
feat(quantity): 완전 구현 및 적용, 테스트 작성
jordy-torvalds 716390f
refactor: 이벤트 구조 개선
jordy-torvalds cdcde36
style: 포맷 정리 및 임포트 최전화
jordy-torvalds File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package kitchenpos.menus.tobe.domain; | ||
|
||
import kitchenpos.menus.domain.MenuGroup; | ||
import kitchenpos.menus.domain.MenuProduct; | ||
|
||
import javax.persistence.*; | ||
import java.math.BigDecimal; | ||
import java.util.List; | ||
import java.util.UUID; | ||
|
||
@Table(name = "menu") | ||
@Entity | ||
public class ToBeMenu { | ||
@Column(name = "id", columnDefinition = "binary(16)") | ||
@Id | ||
private UUID id; | ||
|
||
@Column(name = "name", nullable = false) | ||
private String name; | ||
|
||
@Column(name = "price", nullable = false) | ||
private BigDecimal price; | ||
|
||
@ManyToOne(optional = false) | ||
@JoinColumn( | ||
name = "menu_group_id", | ||
columnDefinition = "binary(16)", | ||
foreignKey = @ForeignKey(name = "fk_menu_to_menu_group") | ||
) | ||
private MenuGroup menuGroup; | ||
|
||
@Column(name = "displayed", nullable = false) | ||
private boolean displayed; | ||
|
||
@OneToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE}) | ||
@JoinColumn( | ||
name = "menu_id", | ||
nullable = false, | ||
columnDefinition = "binary(16)", | ||
foreignKey = @ForeignKey(name = "fk_menu_product_to_menu") | ||
) | ||
private List<MenuProduct> menuProducts; | ||
|
||
@Transient | ||
private UUID menuGroupId; | ||
|
||
protected ToBeMenu() { | ||
} | ||
|
||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/kitchenpos/menus/tobe/domain/ToBeMenuGroup.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,21 @@ | ||
package kitchenpos.menus.tobe.domain; | ||
|
||
import kitchenpos.common.values.Name; | ||
|
||
import javax.persistence.*; | ||
import java.util.UUID; | ||
|
||
@Table(name = "menu_group") | ||
@Entity | ||
public class ToBeMenuGroup { | ||
@Column(name = "id", columnDefinition = "binary(16)") | ||
@Id | ||
private UUID id; | ||
|
||
@Embedded | ||
private Name name; | ||
|
||
protected ToBeMenuGroup() { | ||
} | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/kitchenpos/menus/tobe/domain/ToBeMenuGroupRepository.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,14 @@ | ||
package kitchenpos.menus.tobe.domain; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
import java.util.UUID; | ||
|
||
public interface ToBeMenuGroupRepository { | ||
ToBeMenuGroup save(ToBeMenuGroup menuGroup); | ||
|
||
Optional<ToBeMenuGroup> findById(UUID id); | ||
|
||
List<ToBeMenuGroup> findAll(); | ||
} | ||
|
34 changes: 34 additions & 0 deletions
34
src/main/java/kitchenpos/menus/tobe/domain/ToBeMenuProduct.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,34 @@ | ||
package kitchenpos.menus.tobe.domain; | ||
|
||
|
||
import kitchenpos.products.domain.Product; | ||
|
||
import javax.persistence.*; | ||
import java.util.UUID; | ||
|
||
@Table(name = "menu_product") | ||
@Entity | ||
public class ToBeMenuProduct { | ||
@Column(name = "seq") | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Id | ||
private Long seq; | ||
|
||
@ManyToOne(optional = false) | ||
@JoinColumn( | ||
name = "product_id", | ||
columnDefinition = "binary(16)", | ||
foreignKey = @ForeignKey(name = "fk_menu_product_to_product") | ||
) | ||
private Product product; | ||
|
||
@Column(name = "quantity", nullable = false) | ||
private long quantity; | ||
|
||
@Transient | ||
private UUID productId; | ||
|
||
protected ToBeMenuProduct() { | ||
} | ||
|
||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/kitchenpos/menus/tobe/domain/ToBeMenuRepository.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 kitchenpos.menus.tobe.domain; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
import java.util.UUID; | ||
|
||
public interface ToBeMenuRepository { | ||
ToBeMenu save(ToBeMenu menu); | ||
|
||
Optional<ToBeMenu> findById(UUID id); | ||
|
||
List<ToBeMenu> findAll(); | ||
|
||
List<ToBeMenu> findAllByIdIn(List<UUID> ids); | ||
|
||
List<ToBeMenu> findAllByProductId(UUID productId); | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
용어사전, 모델링에서 사용한 워딩으로 통일해보는 것은 어떤가요?
이해관계자와 소통을 할 때는 displayedName 으로 소통하다가 실제 코드와 불일치로 인해 DDD 의 핵심인 전략적 설계가 희석되는 것 같아요