Skip to content

Commit 22be7b6

Browse files
committed
fix: 재고 수량 검증 로직에 null 및 0 이하 처리 추가
1 parent 60faa37 commit 22be7b6

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

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

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ public Stock decrease(Integer quantity) {
4545
}
4646

4747
public boolean isAvailable(Integer quantity) {
48+
if (quantity == null || quantity <= 0) {
49+
throw new CoreException(ErrorType.BAD_REQUEST, "요청 수량은 0보다 커야 합니다.");
50+
}
4851
return this.value >= quantity;
4952
}
5053
}

0 commit comments

Comments
 (0)