-
Notifications
You must be signed in to change notification settings - Fork 199
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
3단계 - 기능 우선 패키지 #411
base: wooddy-kim
Are you sure you want to change the base?
3단계 - 기능 우선 패키지 #411
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
package kitchenpos.application; | ||
|
||
import kitchenpos.domain.Menu; | ||
import kitchenpos.domain.MenuRepository; | ||
import kitchenpos.domain.Order; | ||
import kitchenpos.domain.OrderLineItem; | ||
import kitchenpos.domain.OrderRepository; | ||
import kitchenpos.domain.OrderStatus; | ||
import kitchenpos.domain.OrderTable; | ||
import kitchenpos.domain.OrderTableRepository; | ||
import kitchenpos.domain.OrderType; | ||
import kitchenpos.infra.KitchenridersClient; | ||
import kitchenpos.domain.menu.Menu; | ||
import kitchenpos.domain.menu.MenuRepository; | ||
Comment on lines
+3
to
+4
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. 주문서 서비스에 menu 패키지가 의존되는 것을 어떻게 막아볼 수 있을까요? |
||
import kitchenpos.domain.order.Order; | ||
import kitchenpos.domain.order.OrderLineItem; | ||
import kitchenpos.domain.order.OrderRepository; | ||
import kitchenpos.domain.order.OrderStatus; | ||
import kitchenpos.domain.order.eatin.OrderTable; | ||
import kitchenpos.domain.order.eatin.OrderTableRepository; | ||
import kitchenpos.domain.order.OrderType; | ||
import kitchenpos.infra.delivery.KitchenridersClient; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
package kitchenpos.application; | ||
|
||
import kitchenpos.domain.Menu; | ||
import kitchenpos.domain.MenuProduct; | ||
import kitchenpos.domain.MenuRepository; | ||
import kitchenpos.domain.Product; | ||
import kitchenpos.domain.ProductRepository; | ||
import kitchenpos.infra.PurgomalumClient; | ||
import kitchenpos.domain.menu.Menu; | ||
import kitchenpos.domain.menu.MenuProduct; | ||
import kitchenpos.domain.menu.MenuRepository; | ||
Comment on lines
+3
to
+5
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. 위와 동일합니다! |
||
import kitchenpos.domain.product.Product; | ||
import kitchenpos.domain.product.ProductRepository; | ||
import kitchenpos.infra.blackword.PurgomalumClient; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
|
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package kitchenpos.domain; | ||
package kitchenpos.domain.menu; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package kitchenpos.domain; | ||
package kitchenpos.domain.menu; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
|
@@ -10,6 +10,7 @@ | |
import jakarta.persistence.ManyToOne; | ||
import jakarta.persistence.Table; | ||
import jakarta.persistence.Transient; | ||
import kitchenpos.domain.product.Product; | ||
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. MenuProduct 와 Product 는 같은 영역의 컨텍스트일까요? |
||
|
||
import java.util.UUID; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package kitchenpos.domain; | ||
package kitchenpos.domain.menu; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package kitchenpos.domain.order.delivery; | ||
|
||
import jakarta.persistence.CascadeType; | ||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.EnumType; | ||
import jakarta.persistence.Enumerated; | ||
import jakarta.persistence.ForeignKey; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.OneToMany; | ||
import jakarta.persistence.Table; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
import java.util.UUID; | ||
|
||
@Table(name = "delivery_orders") | ||
@Entity | ||
public class DeliveryOrder { | ||
@Column(name = "id", columnDefinition = "binary(16)") | ||
@Id | ||
private UUID id; | ||
|
||
@Column(name = "status", nullable = false, columnDefinition = "varchar(255)") | ||
@Enumerated(EnumType.STRING) | ||
private DeliveryOrderStatus status; | ||
|
||
@Column(name = "order_date_time", nullable = false) | ||
private LocalDateTime orderDateTime; | ||
|
||
@OneToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE}) | ||
@JoinColumn( | ||
name = "order_id", | ||
nullable = false, | ||
columnDefinition = "binary(16)", | ||
foreignKey = @ForeignKey(name = "fk_order_line_item_to_orders") | ||
) | ||
private List<DeliveryOrderLineItem> orderLineItems; | ||
|
||
@Column(name = "delivery_address") | ||
private String deliveryAddress; | ||
|
||
public DeliveryOrder() { | ||
} | ||
|
||
public UUID getId() { | ||
return id; | ||
} | ||
|
||
public void setId(final UUID id) { | ||
this.id = id; | ||
} | ||
|
||
public LocalDateTime getOrderDateTime() { | ||
return orderDateTime; | ||
} | ||
|
||
public void setOrderDateTime(final LocalDateTime orderDateTime) { | ||
this.orderDateTime = orderDateTime; | ||
} | ||
|
||
public List<DeliveryOrderLineItem> getOrderLineItems() { | ||
return orderLineItems; | ||
} | ||
|
||
public void setOrderLineItems(final List<DeliveryOrderLineItem> orderLineItems) { | ||
this.orderLineItems = orderLineItems; | ||
} | ||
|
||
public String getDeliveryAddress() { | ||
return deliveryAddress; | ||
} | ||
|
||
public void setDeliveryAddress(final String deliveryAddress) { | ||
this.deliveryAddress = deliveryAddress; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
package kitchenpos.domain.order.delivery; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.ForeignKey; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.ManyToOne; | ||
import jakarta.persistence.Table; | ||
import jakarta.persistence.Transient; | ||
import kitchenpos.domain.menu.Menu; | ||
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. 다음 미션인 리팩터링의 영역을 조금 침범할 수 도 있지만 고려해보면 좋을 것 같아요 :) |
||
|
||
import java.math.BigDecimal; | ||
import java.util.UUID; | ||
|
||
@Table(name = "order_line_item") | ||
@Entity | ||
public class DeliveryOrderLineItem { | ||
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. 새롭게 만들어진 영역의 컨텍스트가 있으면 테스트 코드 또한 작성해봐야 좋을 것 같습니다
|
||
@Column(name = "seq") | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Id | ||
private Long seq; | ||
|
||
@ManyToOne(optional = false) | ||
@JoinColumn( | ||
name = "menu_id", | ||
columnDefinition = "binary(16)", | ||
foreignKey = @ForeignKey(name = "fk_order_line_item_to_menu") | ||
) | ||
private Menu menu; | ||
|
||
@Column(name = "quantity", nullable = false) | ||
private long quantity; | ||
|
||
@Transient | ||
private UUID menuId; | ||
|
||
@Transient | ||
private BigDecimal price; | ||
|
||
public DeliveryOrderLineItem() { | ||
} | ||
|
||
public Long getSeq() { | ||
return seq; | ||
} | ||
|
||
public void setSeq(final Long seq) { | ||
this.seq = seq; | ||
} | ||
|
||
public Menu getMenu() { | ||
return menu; | ||
} | ||
|
||
public void setMenu(final Menu menu) { | ||
this.menu = menu; | ||
} | ||
|
||
public long getQuantity() { | ||
return quantity; | ||
} | ||
|
||
public void setQuantity(final long quantity) { | ||
this.quantity = quantity; | ||
} | ||
|
||
public UUID getMenuId() { | ||
return menuId; | ||
} | ||
|
||
public void setMenuId(final UUID menuId) { | ||
this.menuId = menuId; | ||
} | ||
|
||
public BigDecimal getPrice() { | ||
return price; | ||
} | ||
|
||
public void setPrice(final BigDecimal price) { | ||
this.price = price; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package kitchenpos.domain.order.delivery; | ||
|
||
import kitchenpos.domain.order.Order; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
import java.util.UUID; | ||
|
||
public interface DeliveryOrderRepository { | ||
DeliveryOrder save(Order order); | ||
|
||
Optional<DeliveryOrder> findById(UUID id); | ||
|
||
List<DeliveryOrder> findAll(); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package kitchenpos.domain.order.delivery; | ||
|
||
public enum DeliveryOrderStatus { | ||
WAITING, ACCEPTED, SERVED, DELIVERING, DELIVERED, COMPLETED | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package kitchenpos.domain.order.delivery; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.UUID; | ||
|
||
public interface JpaDeliveryOrderRepository extends DeliveryOrderRepository, JpaRepository<DeliveryOrder, UUID> { | ||
} |
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.
menu service 영역에 product 패키지가 의존되는 것 같은데요
이런 부분도 한번 의존성을 제거해보면 어떨까요?