Skip to content

Commit 60faa37

Browse files
committed
feat: 포인트 충전 로직에 최대 금액 초과 검증 추가
1 parent 1c1ed53 commit 60faa37

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

  • apps/commerce-api/src/main/java/com/loopers/domain/product

apps/commerce-api/src/main/java/com/loopers/domain/product/Product.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class Product extends BaseEntity {
3939
private List<OrderItem> orderItems = new ArrayList<>();
4040

4141
private Product(String name, ProductPrice price, Integer stock, Brand brand) {
42-
validateRequiredFields(name, price, stock);
42+
validateRequiredFields(name, price, stock, brand);
4343
this.name = name;
4444
this.price = price;
4545
this.stock = Stock.of(stock);
@@ -50,7 +50,7 @@ public static Product create(String name, Long price, Integer stock, Brand brand
5050
return new Product(name, ProductPrice.of(price), stock, brand);
5151
}
5252

53-
private void validateRequiredFields(String name, ProductPrice price, Integer stock) {
53+
private void validateRequiredFields(String name, ProductPrice price, Integer stock, Brand brand) {
5454
if (name == null || name.isBlank()) {
5555
throw new CoreException(ErrorType.BAD_REQUEST, "상품명은 필수입니다.");
5656
}
@@ -60,6 +60,9 @@ private void validateRequiredFields(String name, ProductPrice price, Integer sto
6060
if (stock == null) {
6161
throw new CoreException(ErrorType.BAD_REQUEST, "재고는 필수입니다.");
6262
}
63+
if (brand == null) {
64+
throw new CoreException(ErrorType.BAD_REQUEST, "브랜드는 필수입니다.");
65+
}
6366
}
6467

6568
public void decreaseStock(Integer quantity) {

0 commit comments

Comments
 (0)