Skip to content

develop#708

Merged
chaeyn merged 6 commits into
mainfrom
develop
May 7, 2026
Merged

develop#708
chaeyn merged 6 commits into
mainfrom
develop

Conversation

@chaeyn

@chaeyn chaeyn commented May 7, 2026

Copy link
Copy Markdown
Member

변경사항

  • 메인 머지

관련 이슈

Closes #

추가 컨텍스트

@chaeyn chaeyn merged commit 8ee2ea9 into main May 7, 2026
1 check passed

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request adds an isAblePurchase property to products, enabling administrative control over whether a product can be bought. The changes span the database schema, domain entities, DTOs, and the purchase service, which now validates a product's availability before processing a transaction. Reviewers recommended using primitive boolean types instead of Boolean wrappers in the JPA and domain models to eliminate NullPointerException risks and suggested renaming the field to isPurchasable for improved clarity.

Comment on lines +43 to +45
if (!product.isAblePurchase()) {
throw new NotAblePurchaseException();
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

상품의 구매 가능 여부를 체크하는 로직입니다. 만약 product.isAblePurchase()null을 반환할 경우 NullPointerException이 발생할 수 있습니다. 도메인 모델(Product)에서 해당 필드를 기본형 boolean으로 변경하여 null 가능성을 제거하는 것을 권장합니다.

Comment on lines +23 to +24
Boolean isSeasonal,
Boolean isAblePurchase

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

isSeasonalisAblePurchase 필드는 null을 허용하지 않는 논리 값이므로, Boolean 래퍼 타입 대신 기본형 boolean을 사용하는 것이 안전합니다. Boolean 타입을 사용하면 CreatePurchaseService 등에서 조건문으로 평가할 때 null인 경우 NullPointerException이 발생할 위험이 있습니다.

또한, isAblePurchase라는 명칭은 상품이 구매를 '행하는' 주체인 것처럼 오해를 불러일으킬 수 있습니다. 상품이 '구매 가능한' 상태임을 나타내는 isPurchasable 또는 purchasable과 같은 명칭이 더 자연스럽습니다.

Suggested change
Boolean isSeasonal,
Boolean isAblePurchase
boolean isSeasonal,
boolean isAblePurchase

Comment on lines +69 to +70
@Column(nullable = false, columnDefinition = "BOOLEAN DEFAULT TRUE")
private Boolean isAblePurchase;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

nullable = false 제약 조건이 설정되어 있으므로, Boolean 래퍼 타입 대신 기본형 boolean을 사용하는 것이 좋습니다. 이는 불필요한 박싱/언박싱을 방지하고 null 가능성을 차단하여 코드의 안정성을 높여줍니다. (참고: 타입 변경 시 Lombok이 생성하는 Getter 명칭이 isAblePurchase()로 변경될 수 있으니 매퍼 코드 확인이 필요합니다.)

Suggested change
@Column(nullable = false, columnDefinition = "BOOLEAN DEFAULT TRUE")
private Boolean isAblePurchase;
@Column(nullable = false, columnDefinition = "BOOLEAN DEFAULT TRUE")
private boolean isAblePurchase;

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.

3 participants