-
Notifications
You must be signed in to change notification settings - Fork 154
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
base: jordy-torvalds
Are you sure you want to change the base?
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.
μμλ μλ
νμΈμ :)
λ―Έμ
κ³ μνμ
¨μ΅λλ€ π π
μ½λ©νΈ λ¬μλμλλ°μ, νμΈλΆνλλ €μ!
private UUID id; | ||
|
||
@Column(name = "name", nullable = false) | ||
private String name; |
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 μ ν΅μ¬μΈ μ λ΅μ μ€κ³κ° ν¬μλλ κ² κ°μμ
@@ -27,6 +27,7 @@ docker compose -p kitchenpos up -d | |||
- λ©λ΄ κ·Έλ£Ήμ λ±λ‘ν μ μλ€. | |||
- λ©λ΄ κ·Έλ£Ήμ μ΄λ¦μ΄ μ¬λ°λ₯΄μ§ μμΌλ©΄ λ±λ‘ν μ μλ€. | |||
- λ©λ΄ κ·Έλ£Ήμ μ΄λ¦μ λΉμ λ μ μλ€. | |||
- λ©λ΄ κ·Έλ£Ήμ μ΄λ¦μλ λΉμμ΄κ° ν¬ν¨λ μ μλ€. |
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.
λ―Έμ
μ§ννμλ©΄μ μ§μμ μΌλ‘ λͺ¨λΈλ§ μ
λ°μ΄νΈλ λΆνλλ €μ
μ§κΈκΉμ§ λ―Έμ
μ§ννμλ©΄μ λλ©μΈ μ§μμ΄ λ§μ΄ μμ΄μ
¨μ κ² κ°μλ°μ~
ꡬννμ μ½λμ λͺ¨λΈλ§ μ±ν¬ νμΈ λΆνλλ €μ
menuGroup.setId(UUID.randomUUID()); | ||
menuGroup.setName(name); | ||
return menuGroupRepository.save(menuGroup); | ||
public MenuGroupDto create(final CreateRequest request) { |
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 μ μ©νμ ¨λ€μ π π
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public interface AggregateRoot { |
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.
μ κ·Έλ¦¬κ±°νΈ λ£¨νΈλ₯Ό μ§μ μΈν°νμ΄μ€λ₯Ό ν΅ν΄ μ΄λ²€νΈ λ°νκΉμ§ λ§λ€μ΄μ£Όμ
¨λ€μ π π
Spring μμ AbstractAggregateRoot
λ₯Ό μ 곡ν΄μ£Όκ³ μλ κ²μ΄ μλλ°, μ΄κ²λ κ°μ΄ νμΈν΄λ³΄μλ©΄ μ’μ κ² κ°μμ
@Transient | ||
ThreadLocal<List<Object>> threadLocal = ThreadLocal.withInitial(ArrayList::new); | ||
|
||
default Object register(Object event) { |
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.
μΈν°νμ΄μ€μ default λ©μλκ° μΆκ°λ λ°°κ²½μ 무μμΌκΉμ?
μΆμν΄λμ€ λμ μΈν°νμ΄μ€λ₯Ό μ¬μ©νμ μ΄μ κ° μμΌμ€κΉμ? π€
import static kitchenpos.common.exception.KitchenPosExceptionType.BAD_REQUEST; | ||
|
||
@Service | ||
public class MenuProductService { |
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.
λ©λ΄ μν μλΉμ€λ₯Ό λ§λμ μλκ° κΆκΈν΄μ π€
List<CreateMenuProductRequest> menuProductRequests = request.getMenuProducts(); | ||
CollectionUtils.requireNonEmpty(menuProductRequests, new KitchenPosException("λ©λ΄ κ΅¬μ± μνμ΄ μμΌλ―λ‘", BAD_REQUEST)); |
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 μ λν κ²μ¦μ νκ³ μλλ°μ,
λΉκ°μ΄ μλλ€λ κ²μ¦μ 컨νΈλ‘€λ¬μμ ν΄λ³΄λ κ²μ μ΄λ€κ°μ?
spring μμ μ 곡νλ @Valid
λ₯Ό νμ©ν΄λ³Ό μ μμ κ² κ°μμ
productValidator.isExistProducts( | ||
menuProductRequests.stream() | ||
.map(CreateMenuProductRequest::getProductId) | ||
.collect(Collectors.toList()) | ||
); |
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.
λ©λ΄ μν μμ±νλ κ³³μμ κ²μ¦μ΄ μμ΄μ, λ©λ΄ μμ±νλ κ³³μ μμν΄λ³΄λ κ²μ μ΄λ€κ°μ?
return menuRepository.save(menu); | ||
|
||
final List<MenuProduct> menuProducts = menuProductService.create(menuProductRequests); | ||
menuValidator.validatePrice(price, menuProducts); |
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.
menuValidator.validatePrice(price, menuProducts);
μ΄λΆλΆλ λ©λ΄μμ μμ±μμμ κ²μ¦ν΄λ³Ό μ μμ κ² κ°μλ° μ΄λ»κ² μκ°νμΈμ?
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.
μ 체μ μΌλ‘ λλ©μΈ λ‘μ§μ΄λΌ μκ°λλ λΆλΆμ΄ μ΄ν리μΌμ΄μ
κ³μΈ΅μμ μ΄λ€μ§κ³ μλ κ±° κ°μμ
λλ©μΈ κ³μΈ΅μΌλ‘ λ΄λ €λ³΄λ κ² μ΄λ€κ°μ?
κ·Έλ¦¬κ³ λλ©μΈ κ°μ²΄λ€μ ν
μ€νΈ μ½λλ κ°μ΄ μμ±ν΄λ³΄λ κ²μ μ΄λ€κ°μ?
μ‘°κΈλ μ€λͺ μ΄ νμνμλ©΄ λ§μμ£ΌμΈμ!
No description provided.