-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
102 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,4 @@ | |
@Configuration | ||
@EnableJpaAuditing | ||
public class JpaConfig { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 14 additions & 13 deletions
27
src/main/java/org/idiot/yesslave/notice/domain/Notice.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,35 @@ | ||
package org.idiot.yesslave.notice.domain; | ||
|
||
import lombok.Getter; | ||
import org.hibernate.annotations.Comment; | ||
import org.idiot.yesslave.global.jpa.AuditInformation; | ||
import org.idiot.yesslave.notice.dto.NoticeSaveRequest; | ||
|
||
import javax.persistence.*; | ||
|
||
@Entity | ||
@Getter | ||
public class Notice extends AuditInformation { | ||
@Id @GeneratedValue(strategy=GenerationType.IDENTITY) | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
@Column(length=50, nullable = false) | ||
@Column(length = 50, nullable = false) | ||
@Comment("제목") | ||
private String title; | ||
|
||
@Column(columnDefinition = "TEXT", nullable = false) | ||
@Comment("내용") | ||
private String content; | ||
|
||
/* | ||
@ManyToOne(fetch=FetchType.LAZY) | ||
@Column(name="USER_ID") | ||
private Long userId; | ||
*/ | ||
protected Notice() {} | ||
private Notice(String title, String content){ | ||
this.title=title; | ||
this.content=content; | ||
protected Notice() { | ||
} | ||
|
||
private Notice(String title, String content) { | ||
this.title = title; | ||
this.content = content; | ||
} | ||
|
||
public static Notice createNotice(String title, String content){ | ||
return new Notice(title, content); | ||
public static Notice createNotice(NoticeSaveRequest noticeSaveRequest) { | ||
return new Notice(noticeSaveRequest.getTitle(), noticeSaveRequest.getContent()); | ||
} | ||
} |
10 changes: 5 additions & 5 deletions
10
src/main/java/org/idiot/yesslave/notice/dto/NoticeSaveRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters