Skip to content

Commit 0e945df

Browse files
committed
refactor: 검증 로직 오타 수정 및 DB 레벨 제약을 위한 @column(nullable = false) 추가
1 parent d49b863 commit 0e945df

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

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

apps/commerce-api/src/main/java/com/loopers/domain/brand/Brand.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,18 @@
33
import com.loopers.domain.BaseEntity;
44
import com.loopers.support.error.CoreException;
55
import com.loopers.support.error.ErrorType;
6+
import jakarta.persistence.Column;
67
import jakarta.persistence.Entity;
78
import jakarta.persistence.Table;
89

910
@Entity
1011
@Table(name = "brand")
1112
public class Brand extends BaseEntity {
1213

14+
@Column(nullable = false)
1315
private String name;
16+
17+
@Column(nullable = false)
1418
private String description;
1519

1620
protected Brand() {
@@ -22,7 +26,7 @@ public Brand(String name, String description) {
2226
}
2327

2428
if (description == null || description.isBlank()) {
25-
throw new CoreException(ErrorType.BAD_REQUEST, "이름은 필수입니다.");
29+
throw new CoreException(ErrorType.BAD_REQUEST, "설명은 필수입니다.");
2630
}
2731

2832
this.name = name;

0 commit comments

Comments
 (0)