55import dmu .dasom .api .domain .news .dto .NewsResponseDto ;
66import io .swagger .v3 .oas .annotations .media .Schema ;
77import jakarta .persistence .*;
8- import jakarta .validation .constraints .NotBlank ;
9- import jakarta .validation .constraints .NotNull ;
10- import jakarta .validation .constraints .Size ;
118import lombok .*;
129
1310@ Getter
@@ -24,20 +21,17 @@ public class NewsEntity extends BaseEntity {
2421 @ Schema (description = "뉴스 ID" , example = "1" )
2522 private Long id ;
2623
27- @ NotNull
28- @ Schema (description = "뉴스 제목" , example = "뉴스 예제 제목" )
2924 @ Column (nullable = false , length = 100 )
25+ @ Schema (description = "뉴스 제목" , example = "뉴스 예제 제목" )
3026 private String title ;
3127
3228 @ Lob
33- @ NotNull
34- @ Schema (description = "뉴스 내용" , example = "뉴스 예제 내용" )
3529 @ Column (nullable = false )
30+ @ Schema (description = "뉴스 내용" , example = "뉴스 예제 내용" )
3631 private String content ;
3732
38-
39- @ Schema (description = "뉴스 이미지 URL" , example = "http://example.com/image.jpg" )
4033 @ Column (length = 255 )
34+ @ Schema (description = "뉴스 이미지 URL" , example = "http://example.com/image.jpg" )
4135 private String imageUrl ;
4236
4337 // 뉴스 상태 업데이트
@@ -50,21 +44,8 @@ public NewsResponseDto toResponseDto() {
5044 return new NewsResponseDto (id , title , content , getCreatedAt (), imageUrl );
5145 }
5246
53- //수정기능
47+ // 수정
5448 public void update (String title , String content , String imageUrl ) {
55- if (title == null || title .isBlank ()) {
56- throw new IllegalArgumentException ("제목은 필수입니다" );
57- }
58- if (title .length () > 100 ) {
59- throw new IllegalArgumentException ("제목은 100자까지" );
60- }
61- if (content == null || content .isBlank ()) {
62- throw new IllegalArgumentException ("내용은 필수입니다" );
63- }
64- if (imageUrl != null && imageUrl .length () > 255 ) {
65- throw new IllegalArgumentException ("이미지 URL은 255자까지" );
66- }
67-
6849 this .title = title ;
6950 this .content = content ;
7051 this .imageUrl = imageUrl ;
0 commit comments