Skip to content

Commit 6c708a3

Browse files
committed
feat: 예외 메시지 상수를 enum으로 관리하도록 개선
- 예외 메시지를 ExceptionMessage enum으로 분리하여 중앙 관리 - 상수로 관리하여 메시지의 일관성 유지 및 중복 제거 - 향후 메시지 변경 시 한 곳에서 관리 가능하도록 개선
1 parent 32ca631 commit 6c708a3

File tree

4 files changed

+82
-47
lines changed

4 files changed

+82
-47
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
package com.somemore.center.domain;
2+
3+
import com.somemore.global.common.BaseEntity;
4+
import jakarta.persistence.*;
5+
import lombok.*;
6+
7+
import java.util.UUID;
8+
9+
10+
@NoArgsConstructor(access = AccessLevel.PROTECTED)
11+
@Getter
12+
@Entity
13+
public class Center extends BaseEntity {
14+
15+
@Id
16+
@GeneratedValue(strategy = GenerationType.UUID)
17+
@Column(nullable = false, length = 16)
18+
private UUID id;
19+
20+
@Column(name = "name", nullable = false)
21+
private String name;
22+
23+
@Column(name = "contact_number", nullable = false)
24+
private String contactNumber;
25+
26+
@Column(name = "img_url", nullable = false)
27+
private String imgUrl;
28+
29+
@Column(name = "introduce", columnDefinition = "TEXT", nullable = false)
30+
private String introduce;
31+
32+
@Column(name = "homepage_link", nullable = false)
33+
private String homepageLink;
34+
35+
@Column(name = "account_id", nullable = false)
36+
private String accountId;
37+
38+
@Column(name = "account_pw", nullable = false)
39+
private String accountPw;
40+
41+
42+
@Builder
43+
private Center(String name, String contactNumber, String imgUrl, String introduce, String homepageLink, String accountId, String accountPw) {
44+
45+
this.name = name;
46+
this.contactNumber = contactNumber;
47+
this.imgUrl = imgUrl;
48+
this.introduce = introduce;
49+
this.homepageLink = homepageLink;
50+
this.accountId = accountId;
51+
this.accountPw = accountPw;
52+
}
53+
54+
public static Center create(String name, String contactNumber, String imgUrl, String introduce, String homepageLink, String accountId, String accountPw) {
55+
return Center.builder()
56+
.name(name)
57+
.contactNumber(contactNumber)
58+
.imgUrl(imgUrl)
59+
.introduce(introduce)
60+
.homepageLink(homepageLink)
61+
.accountId(accountId)
62+
.accountPw(accountPw)
63+
.build();
64+
}
65+
66+
}

src/main/java/com/somemore/domains/Center.java

Lines changed: 0 additions & 42 deletions
This file was deleted.

src/main/java/com/somemore/global/exception/BadRequestException.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@
44

55
public class BadRequestException extends RuntimeException{
66

7-
public BadRequestException() {
8-
super();
9-
}
10-
11-
public BadRequestException(String message) {
7+
public BadRequestException(final String message) {
128
super(message);
139
}
1410
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.somemore.global.exception;
2+
3+
4+
import lombok.Getter;
5+
import lombok.RequiredArgsConstructor;
6+
7+
@RequiredArgsConstructor
8+
@Getter
9+
public enum ExceptionMessage {
10+
11+
NOT_EXISTS_CENTER("존재하지 않는 기관 ID 입니다.")
12+
;
13+
14+
private final String message;
15+
}

0 commit comments

Comments
 (0)