-
Notifications
You must be signed in to change notification settings - Fork 177
3단계 - 리팩터링(매장 식사 주문) #321
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
Open
jivebreaddev
wants to merge
83
commits into
next-step:jivebreaddev
Choose a base branch
from
jivebreaddev:step3
base: jivebreaddev
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
3단계 - 리팩터링(매장 식사 주문) #321
Changes from all commits
Commits
Show all changes
83 commits
Select commit
Hold shift + click to select a range
fb66fab
feat(Product): Product VO인 ProductPrice, ProductName 추가
jivebreaddev fd34ab6
test(Product): Product -> ProductTest로 수정하다가 잘못 refactor 된부분들 수정
jivebreaddev 2364aeb
test(Product): Product, ProductName, ProductPrice 도메인 레이어 테스트 생성
jivebreaddev 6a5cfd6
test(Product): 안쓰는 add 제거
jivebreaddev a35761a
feature(ProductService): domain 패키지에서 product를 dto로 변경하고 리팩토링한 produc…
jivebreaddev 14d0b19
feature(Menu): Repository 및 의존성 변경 && entity fields 생성했습니다.
jivebreaddev a5adc1e
feat(DIP) domain 패키지로 interface를 이전하고 JPA REPOSITORY들은 INFRA로 이동한다.
Jivebread 696159b
feat(tobe-domain) domain 패키지로 VO 객체들을 생성하고 2개의 aggregate들을 생성하였습니다. 그…
Jivebread 4500454
feat(tobe-domain) application 레이어로 dto 이전
Jivebread 9022d96
feat(tobe-domain) 1. 주석제거
Jivebread e090c82
feat(tobe-domain): Fixtures 와 ProductFixture 통합으로 Fixtures으로 이전
Jivebread 503bb09
test(ProductTest): static 필드 값을 명시적 값으로 변경
Jivebread 7877dce
test(Repository, Validator): 가짜객체들 별도의 패키지(infra)로 분리
Jivebread ab7a8b0
feature(README): 도메인 모델링 사항 반영
Jivebread e3e5d4e
Merge branch 'step1' into step2
Jivebread 6d141da
feature(README): 도메인 모델링 사항 반영
Jivebread c6942fc
feature(ProductService): productService 에서 menu에 대한 로직 제거
Jivebread e7ce0c7
feature(MenuGroup & MenuGroupTest): MenuGroup과 VO 생성 및 TEST 생성했습니다.
Jivebread 841869e
feature(MenuGroup & MenuGroupTest): 필요없는 IMPORT 제거
Jivebread f584363
feature(MenuGroup & MenuGroupTest): 모델링에서 메뉴 카테고리의 영어이름 MENU GROUP으로 …
Jivebread bc582af
feature(MenuGroup): Equals & Hash 생성
Jivebread d324b3f
feature(MenuName): Equals & Hash 생성
Jivebread 1c6dabb
test(MenuGroupTest): Menugroup 도메인 테스트 생성하였습니다.
Jivebread c5d7d7b
FEATURE(README): 모델링 수정 -> 난잡한 언어 간소화
Jivebread 040a51c
FEATURE(Menu): 원래의 menu를 request로 수정하고 Menu도메인 객체 생성
Jivebread c872bcf
FEATURE(Menu): 원래의 menu를 request로 수정하고 Menu도메인 객체 생성
Jivebread f39e4d2
FEATURE(Menu): Menu VO 생성
Jivebread 48b361d
FEATURE(Menu): 원래 MenuProducts를 MenuProductsRequest로 변경
Jivebread e674bce
FEATURE(Menu): 원래 MenuGroup을 MenuGroupRequest로 변경
Jivebread b1fa041
FEATURE(Menu): 원래 MenuGroup을 MenuGroupRequest로 변경
Jivebread f49c2a7
FEATURE(Menu): Menu 도메인 로직 구현
Jivebread a823a21
FEATURE(Menu): Menu Application 로직 구현
Jivebread 8fc08f4
Test(MenuPriceTest): MenuPrice에 대한 테스트 구현
Jivebread e292ae0
Feature(Order): Order에서 Menu -> MenuRequest 에 따른 사이드이펙트 수정
Jivebread 813f032
test(Test): Test 실패에 따른 수정들 진행했습니다.
Jivebread 8cad4f1
chores(merge): merge conflict 제거
Jivebread e746770
test(JPAMenuRepository): JPA 오류 제거
Jivebread b1230ef
feature(Menu): 메뉴의 vo들을 가져오는 로직중 long 과 bigdecimal 두개다 지원할 수 있도록 변경하였…
Jivebread e3ec256
test(MenuTest): 메뉴들에 대한 테스트를 실행 될수있도록 수정하였습니다.
Jivebread cb840ae
feature(menu): EQUALS & HASHCODE 생성
Jivebread 85080b3
test(MenuTest): 메뉴들에 대한 테스트를 실행 될수있도록 수정하였습니다.
Jivebread dca105f
feature(Menu): Zero 에 대한 접근제어자 제거
Jivebread f2444d6
feature(ProfanityValidator): 비속어 검증 로직에 대한 인터페이스를 공통으로 이전했습니다.
Jivebread 894c982
feature(Price): 가격(Price)을 공통 값객체로 변경하였습니다.
Jivebread 7acc8f0
feature(Price): final 키워드 수정
Jivebread 0c607c4
feature(ProductPriceChange): ProductPriceChangeEvent 구현했습니다.
Jivebread de52e73
test(ProductPriceChange): ProductPriceChangeEvent에 대한 검증을 진행했습니다.
Jivebread 7b89e31
feature(MenuDomainService): MenuDomainService 로 여러개의 Aggregate에 대한 로직…
Jivebread 3748220
chore(order, orderTable jpa repositories): OrderTable들에 대한 jpa reposi…
jivebreaddev 0638e6c
chore(Order, OrderTable DTOS): order과 ordertable에 대한 원래의 entity를 dto로…
jivebreaddev 7c41b14
chore(Order, OrderTable DTOS): order과 ordertable에 대한 원래의 entity를 dto로…
jivebreaddev d0b28a6
chore(Order, OrderTable DTOS): order과 ordertable에 대한 원래의 entity를 dto로…
jivebreaddev 1f9c6b2
feature(Order, OrderTable DTOS): Order와 orderTable 에 대한 vo들을 생성하였습니다.
jivebreaddev 5739302
Merge branch 'step-4' of https://github.com/jivebreaddev/ddd-tactical…
Jivebread ca467ab
feature(OrderTable): OrderTable 관련 VO 객체들을 생성하였습니다.
Jivebread bf8c37a
feature(OrderTable): OrderTable 관련 VO 객체들을 생성하였습니다.
Jivebread 26c862f
test(OrderTable): OrderTable 관련 VO 객체들에 대한 테스트를 생성하였습니다.
Jivebread 1c2cee9
chore(MenuGroup): Test 패키지의 MenuProduct -> Menugroup으로 패키지 이름 명명 변경합니다.
Jivebread cf1f88f
feature(OrderTable): OrderTable 관련 Service를 정리하고 원래 객체를 dto로 올립니다.
Jivebread b7bfe26
test(OrderTableService): OrderTableService 에 대한 테스트를 수정합니다.
Jivebread 7070974
feature(OrderLineItems): OrderLineItem에 대한 도메인 로직을 생성하였습니다.
Jivebread 1b36f30
chore(MenuProducts): MenuProducts 포맷팅
Jivebread c834896
test(OrderLineItems): OrderLineItems 에 대해서 테스트를 생성하였습니다.
Jivebread 47ff4d2
feature(OrderTable): OrderTable은 Order와 라이프사이클이 동일하여 간접참조가 아니라 직접참조로 …
Jivebread 0b151c0
feature(OrderTable): OrderTable은 Order와 라이프사이클이 동일하여 간접참조가 아니라 직접참조로 …
Jivebread ae4c72e
feature(OrderTable): OrderTable은 Order와 라이프사이클이 동일하여 간접참조가 아니라 직접참조로 …
Jivebread 3023cb6
feature(OrderTable): OrderTable은 Order와 라이프사이클이 동일하여 간접참조가 아니라 직접참조로 …
Jivebread 4aa2f3b
feature(Order): Order 에 대한 validation 로직 생성
Jivebread 642c8dc
feature(Order): Order에 대해 EAT_IN, DELIVERY, TAKEOUT 으로 분리하였습니다.
Jivebread 732d12a
feature(DomainService, FactoryService): Annotation을 생성하였습니다.
Jivebread 77eace3
feature(DomainService, FactoryService): Annotation을 생성하였습니다.
Jivebread 6425125
feature(PassToRiderService, FactoryService): OrderFactory와 PassToRide…
Jivebread fc351ba
feature(OrderTable과 Order): Order들을 각각 EatInOrder 와 DeliveryOrder, Ta…
Jivebread 45c6cae
feature(Order): Order 을 dto로 변경하면서 생기는 변경들 수정하였습니다.
Jivebread 81d84ca
feature(Order): Order 을 dto로 변경하면서 생기는 변경들 수정하였습니다.
Jivebread 2f72593
feature(OrderService): OrderService의 도메인 로직들을 전부 도메인으로 내렸습니다.
Jivebread 23177f5
feature(OrderRepository): OrderRepository의 existsByOrderTableAndStatu…
Jivebread 60431a0
CHORE(요구사항): 요구사항 언어에 대한 변경하였습니다.
Jivebread b508959
CHORE(구현사항): 구현사항 정리하였습니다.
Jivebread 318105f
TEST(Products): ProductEventTest 가 정상 동작하지않아서 수정을하였습니다. 이벤트가 발행이 안되는 …
Jivebread 8c72813
feature(Menu): Menu 연관관계 맵핑 했습니다.
Jivebread 4f20ba1
test(Order): 테스트하면서 로직에 대해서 수정하였습니다.
Jivebread dab8d8c
Update REQUIREMENTS.md
jivebreaddev 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 hidden or 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 hidden or 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,58 @@ | ||
| ## 과제 요구사항 | ||
|
|
||
| 1. 상품 context 리팩터링 | ||
| - 도메인 계층 구현하기 | ||
| - 도메인 서비스 | ||
| - 간접 참조로 aggregate 구현하기 | ||
| - REPOSITORY 구현 | ||
| - Validator 구현 | ||
| - 도메인 부분에서 VO 랑 AGGGREGATE 용 | ||
| - 식별을 위한 ID, 추가 | ||
| - VALIDATION을 위한 값들 추가 | ||
| - 테스트 작성 | ||
|
|
||
|
|
||
|
|
||
| 3. EAT_IN ORDER 리팩터링 구현사항 | ||
| A. 연관관계 설정 및 VO 및 도메인 로직 구현 | ||
| - ORDER (바운디드 컨텍스트는 넓게 잡기가 선호되서 하나의 패키지로 구현하였습니다.) | ||
| - EAT_IN | ||
| - DELIVERY | ||
| - DELIVERY 주문의 외부 연동 도메인 로직을 DOMAIN SERVICE로 주입 | ||
| - TAKEOUT | ||
| - 생성 도메인 로직 | ||
| - 상태 변환 도메인 로직 | ||
| - FACTORY로 각 ORDER에 대한 생성로직 따로 클래스로 생성 | ||
|
|
||
| - ORDER ITEMS | ||
| - 생성 도메인로직 | ||
| - 메뉴에 대한 의존성을 MenuClient로 가져오는 객체는 OrderMenu로 명시적 표기 | ||
| - N+1 문제를 쿼리 한번으로 변경 | ||
|
|
||
| - ORDERTABLE | ||
| - 생성 도메인 로직 | ||
| - 치우기 도메인 로직 | ||
| - OrderTable에서 Order에 대해 접근할때, domain service로 주입 | ||
| - ORDER SERVICE | ||
| - 서비스에 있는 도메인 로직 도메인 객체안으로 넣기 | ||
|
|
||
| B. @DOMAIN SERVICE 와 @DOMAIN FACTORY에 대한 에노테이션 생성으로 명시적 표기 | ||
|
|
||
|
|
||
| 1. 책에 따라 DOMAIN SERVICE를 METHOD 호출시 전달하게끔 변경하였습니다. '외부 시스템 연동이 필요한 도메인 로직일때 혹은 계산로직일때' | ||
|
|
||
|
|
||
| 2. 1-N(주문, 주문항목들) 의 경우 N이 많아질 때가 있는데 해당부분은 어떻게 구현하실지 궁금합니다. | ||
|
|
||
|
|
||
| 3. 주문 타입의 경우가 많아지면, 어떤 타입 -> 팩토리에 대한 맵핑을 지원하는 디자인 패턴을 사용하시나요? | ||
|
|
||
|
|
||
| 4. 지금 상태에서 실무에 돌입하게 되면 ORDER 와 EATIN ORDER의 관계에서 상속이 객체지향적이지 않아 보여요! (EJ 합성 > 상속) | ||
| - 웅래님은 만약 실무였다면, 어떻게 구현하셨을지 궁금합니다. | ||
| - 저라면, 공유커널(COMMON)에 빈 껍데기 ORDER, ORDERITEMS를 두기 | ||
| - 공유커널을 상속받아서 DOMAIN ENTITY들을 각각 EATIN_ORDER, DELIVERY_ORDER, TAKEOUT_ORDER 패키지에서 각각 상속받아서 생성했을것같아요 | ||
|
|
||
| 5. 마지막으로, 공유커널(COMMON)에 있는 이벤트들은 내부 이벤트(내부 서비스) VS 외부 이벤트(외부 서비스) 들이 있을것 같아요 | ||
| - 보통은 어떻게 나누시나요? (인터페이스?, 마커 인터페이스?) | ||
|
|
This file contains hidden or 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 |
|---|---|---|
| @@ -1,24 +1,24 @@ | ||
| ### | ||
| POST {{host}}/api/order-tables | ||
| POST {{host}}/api/orderRequest-tables | ||
| Content-Type: application/json | ||
|
|
||
| { | ||
| "name": "9번" | ||
| } | ||
|
|
||
| ### | ||
| PUT {{host}}/api/order-tables/8d710043-29b6-420e-8452-233f5a035520/sit | ||
| PUT {{host}}/api/orderRequest-tables/8d710043-29b6-420e-8452-233f5a035520/sit | ||
|
|
||
| ### | ||
| PUT {{host}}/api/order-tables/8d710043-29b6-420e-8452-233f5a035520/clear | ||
| PUT {{host}}/api/orderRequest-tables/8d710043-29b6-420e-8452-233f5a035520/clear | ||
|
|
||
| ### | ||
| PUT {{host}}/api/order-tables/8d710043-29b6-420e-8452-233f5a035520/number-of-guests | ||
| PUT {{host}}/api/orderRequest-tables/8d710043-29b6-420e-8452-233f5a035520/number-of-guests | ||
| Content-Type: application/json | ||
|
|
||
| { | ||
| "numberOfGuests": 4 | ||
| } | ||
|
|
||
| ### | ||
| GET {{host}}/api/order-tables | ||
| GET {{host}}/api/orderRequest-tables |
This file contains hidden or 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 hidden or 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
13 changes: 13 additions & 0 deletions
13
src/main/java/kitchenpos/common/annotation/DomainService.java
This file contains hidden or 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,13 @@ | ||
| package kitchenpos.common.annotation; | ||
|
|
||
| import org.springframework.stereotype.Component; | ||
|
|
||
| import java.lang.annotation.*; | ||
|
|
||
| @Target(ElementType.TYPE) | ||
| @Inherited | ||
| @Documented | ||
| @Retention(RetentionPolicy.RUNTIME) | ||
| @Component | ||
| public @interface DomainService { | ||
|
Comment on lines
+7
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 명시적으로 도메인서비스를 나타내는 커스텀 어노테이션 👍 👍 |
||
| } | ||
13 changes: 13 additions & 0 deletions
13
src/main/java/kitchenpos/common/annotation/FactoryService.java
This file contains hidden or 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,13 @@ | ||
| package kitchenpos.common.annotation; | ||
|
|
||
| import org.springframework.stereotype.Component; | ||
|
|
||
| import java.lang.annotation.*; | ||
|
|
||
| @Target(ElementType.TYPE) | ||
| @Inherited | ||
| @Documented | ||
| @Retention(RetentionPolicy.RUNTIME) | ||
| @Component | ||
| public @interface FactoryService { | ||
| } |
2 changes: 1 addition & 1 deletion
2
...enpos/eatinorders/domain/OrderStatus.java → ...pos/common/domain/orders/OrderStatus.java
This file contains hidden or 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
13 changes: 13 additions & 0 deletions
13
src/main/java/kitchenpos/common/domain/orders/OrderTableStatus.java
This file contains hidden or 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,13 @@ | ||
| package kitchenpos.common.domain.orders; | ||
|
|
||
| public enum OrderTableStatus { | ||
| UNOCCUPIED, OCCUPIED; | ||
|
|
||
| OrderTableStatus OrderTableStatus(boolean occupied) { | ||
| if (occupied) { | ||
| return OrderTableStatus.OCCUPIED; | ||
| } | ||
|
|
||
| return OrderTableStatus.OCCUPIED; | ||
| } | ||
| } |
2 changes: 1 addition & 1 deletion
2
...chenpos/eatinorders/domain/OrderType.java → .../common/domain/ordertables/OrderType.java
This file contains hidden or 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
21 changes: 21 additions & 0 deletions
21
src/main/java/kitchenpos/common/domain/products/ProductPriceChangeEvent.java
This file contains hidden or 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.common.domain.products; | ||
|
|
||
| import java.util.UUID; | ||
|
|
||
| public class ProductPriceChangeEvent { | ||
| private final UUID productId; | ||
| private final Long price; | ||
|
|
||
| public ProductPriceChangeEvent(UUID productId, Long price) { | ||
| this.productId = productId; | ||
| this.price = price; | ||
| } | ||
|
|
||
| public UUID getProductId() { | ||
| return productId; | ||
| } | ||
|
|
||
| public Long getPrice() { | ||
| return price; | ||
| } | ||
| } |
Oops, something went wrong.
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.
꾸준한 모델링 업데이트 👍 👍
다만, 모델링에 그림이 혹시 어떤 것을 뜻하는 것일까요? 🤔
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.
그림은 원래 있었는데 추가해두지 않았습니다. 해당부분도 삭제하겠습니다!