Skip to content
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
wants to merge 13 commits into
base: jordy-torvalds
Choose a base branch
from

Conversation

jordy-torvalds
Copy link

No description provided.

Copy link

@wlroh wlroh left a 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;
Copy link

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
- 메뉴 그룹을 등둝할 수 μžˆλ‹€.
- 메뉴 그룹의 이름이 μ˜¬λ°”λ₯΄μ§€ μ•ŠμœΌλ©΄ 등둝할 수 μ—†λ‹€.
- 메뉴 그룹의 이름은 λΉ„μ›Œ λ‘˜ 수 μ—†λ‹€.
- 메뉴 그룹의 μ΄λ¦„μ—λŠ” 비속어가 포함될 수 μ—†λ‹€.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

μ§€μ†μ μœΌλ‘œ μš”κ΅¬μ‚¬ν•­ μˆ˜μ • πŸ‘ πŸ‘
μš”κ΅¬μ‚¬ν•­μ— 변경됨에 따라 λͺ¨λΈλ§λ„ μˆ˜μ •ν•΄λ³΄λŠ” 것은 μ–΄λ–€κ°€μš”?

Copy link

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) {
Copy link

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 {
Copy link

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) {
Copy link

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 {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

메뉴 μƒν’ˆ μ„œλΉ„μŠ€λ₯Ό λ§Œλ“œμ‹  μ˜λ„κ°€ κΆκΈˆν•΄μš” πŸ€”

Comment on lines +51 to +52
List<CreateMenuProductRequest> menuProductRequests = request.getMenuProducts();
CollectionUtils.requireNonEmpty(menuProductRequests, new KitchenPosException("메뉴 ꡬ성 μƒν’ˆμ΄ μ—†μœΌλ―€λ‘œ", BAD_REQUEST));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

μ• ν”Œλ¦¬μΌ€μ΄μ…˜ λ‹¨μ—μ„œ DTO 에 λŒ€ν•œ 검증을 ν•˜κ³  μžˆλŠ”λ°μš”,
λΉˆκ°’μ΄ μ•„λ‹ˆλ‹€λŠ” 검증을 μ»¨νŠΈλ‘€λŸ¬μ—μ„œ ν•΄λ³΄λŠ” 것은 μ–΄λ–€κ°€μš”?
spring μ—μ„œ μ œκ³΅ν•˜λŠ” @Valid λ₯Ό ν™œμš©ν•΄λ³Ό 수 μžˆμ„ 것 κ°™μ•„μš”

Comment on lines +58 to 62
productValidator.isExistProducts(
menuProductRequests.stream()
.map(CreateMenuProductRequest::getProductId)
.collect(Collectors.toList())
);
Copy link

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);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

menuValidator.validatePrice(price, menuProducts);

이뢀뢄도 λ©”λ‰΄μ—μ„œ μƒμ„±μžμ—μ„œ 검증해볼 수 μžˆμ„ 것 같은데 μ–΄λ–»κ²Œ μƒκ°ν•˜μ„Έμš”?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

μ „μ²΄μ μœΌλ‘œ 도메인 둜직이라 μƒκ°λ˜λŠ” 뢀뢄이 μ–΄ν”Œλ¦¬μΌ€μ΄μ…˜ κ³„μΈ΅μ—μ„œ 이뀄지고 μžˆλŠ” κ±° κ°™μ•„μš”
도메인 κ³„μΈ΅μœΌλ‘œ λ‚΄λ €λ³΄λŠ” 것 μ–΄λ–€κ°€μš”?
그리고 도메인 κ°μ²΄λ“€μ˜ ν…ŒμŠ€νŠΈ μ½”λ“œλ„ 같이 μž‘μ„±ν•΄λ³΄λŠ” 것은 μ–΄λ–€κ°€μš”?

μ‘°κΈˆλ” μ„€λͺ…이 ν•„μš”ν•˜μ‹œλ©΄ λ§μ”€μ£Όμ„Έμš”!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants