-
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.
Browse files
Browse the repository at this point in the history
* ✨ Feature/#157 - 게시글(Board) 도메인 구현 * ✨ Feature/#157 - 댓글(Comment) 도메인 구현 * ✨ Feature/#157 - 공감(Like) 도메인 구현 * ✨ Feature/#157 - 신문고(Suggestion) 도메인그룹 구현
- Loading branch information
1 parent
11a23d2
commit b6e9a7d
Showing
16 changed files
with
211 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
65 changes: 65 additions & 0 deletions
65
src/main/java/com/daon/onjung/suggestion/domain/Board.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 |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package com.daon.onjung.suggestion.domain; | ||
|
||
import com.daon.onjung.account.domain.User; | ||
import jakarta.persistence.*; | ||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Table(name = "boards") | ||
public class Board { | ||
/* -------------------------------------------- */ | ||
/* Default Column ----------------------------- */ | ||
/* -------------------------------------------- */ | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
/* -------------------------------------------- */ | ||
/* Information Column ------------------------- */ | ||
/* -------------------------------------------- */ | ||
@Column(name = "title", length = 20, nullable = false) | ||
private String title; | ||
|
||
@Column(name = "content", length = 500, nullable = false) | ||
private String content; | ||
|
||
@Column(name = "img_url", length = 2080, nullable = true) | ||
private String imgUrl; | ||
|
||
@Column(name = "like_count", nullable = false) | ||
private Integer likeCount; | ||
|
||
/* -------------------------------------------- */ | ||
/* Timestamp Column --------------------------- */ | ||
/* -------------------------------------------- */ | ||
@Column(name = "created_at", nullable = false, updatable = false) | ||
private LocalDateTime createdAt; | ||
|
||
/* -------------------------------------------- */ | ||
/* Many To One Mapping ------------------------ */ | ||
/* -------------------------------------------- */ | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "users_id", nullable = false) | ||
private User user; | ||
|
||
/* -------------------------------------------- */ | ||
/* Methods ------------------------------------ */ | ||
/* -------------------------------------------- */ | ||
@Builder | ||
public Board(String title, String content, String imgUrl, User user) { | ||
this.title = title; | ||
this.content = content; | ||
this.imgUrl = imgUrl; | ||
this.user = user; | ||
this.likeCount = 0; | ||
this.createdAt = LocalDateTime.now(); | ||
} | ||
|
||
} |
57 changes: 57 additions & 0 deletions
57
src/main/java/com/daon/onjung/suggestion/domain/Comment.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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package com.daon.onjung.suggestion.domain; | ||
|
||
import com.daon.onjung.account.domain.User; | ||
import jakarta.persistence.*; | ||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Table(name = "comments") | ||
public class Comment { | ||
/* -------------------------------------------- */ | ||
/* Default Column ----------------------------- */ | ||
/* -------------------------------------------- */ | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
/* -------------------------------------------- */ | ||
/* Information Column ------------------------- */ | ||
/* -------------------------------------------- */ | ||
@Column(name = "content", length = 100, nullable = false) | ||
private String content; | ||
|
||
/* -------------------------------------------- */ | ||
/* Timestamp Column --------------------------- */ | ||
/* -------------------------------------------- */ | ||
@Column(name = "created_at", nullable = false, updatable = false) | ||
private LocalDateTime createdAt; | ||
|
||
/* -------------------------------------------- */ | ||
/* Many To One Mapping ------------------------ */ | ||
/* -------------------------------------------- */ | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "users_id", nullable = false) | ||
private User user; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "boards_id", nullable = false) | ||
private Board board; | ||
|
||
/* -------------------------------------------- */ | ||
/* Methods ------------------------------------ */ | ||
/* -------------------------------------------- */ | ||
@Builder | ||
public Comment(String content, User user, Board board) { | ||
this.content = content; | ||
this.user = user; | ||
this.board = board; | ||
this.createdAt = LocalDateTime.now(); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.daon.onjung.suggestion.domain; | ||
|
||
import com.daon.onjung.account.domain.User; | ||
import jakarta.persistence.*; | ||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Table(name = "likes") | ||
public class Like { | ||
/* -------------------------------------------- */ | ||
/* Default Column ----------------------------- */ | ||
/* -------------------------------------------- */ | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
/* -------------------------------------------- */ | ||
/* Many To One Mapping ------------------------ */ | ||
/* -------------------------------------------- */ | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "users_id", nullable = false) | ||
private User user; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "boards_id", nullable = false) | ||
private Board board; | ||
|
||
/* -------------------------------------------- */ | ||
/* Methods ------------------------------------ */ | ||
/* -------------------------------------------- */ | ||
@Builder | ||
public Like(User user, Board board) { | ||
this.user = user; | ||
this.board = board; | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/com/daon/onjung/suggestion/domain/service/BoardService.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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.daon.onjung.suggestion.domain.service; | ||
|
||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
public class BoardService { | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/com/daon/onjung/suggestion/domain/service/CommentService.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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.daon.onjung.suggestion.domain.service; | ||
|
||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
public class CommentService { | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/com/daon/onjung/suggestion/domain/service/LikeService.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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.daon.onjung.suggestion.domain.service; | ||
|
||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
public class LikeService { | ||
} |
Empty file.
9 changes: 9 additions & 0 deletions
9
src/main/java/com/daon/onjung/suggestion/repository/mysql/BoardRepository.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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.daon.onjung.suggestion.repository.mysql; | ||
|
||
import com.daon.onjung.suggestion.domain.Board; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface BoardRepository extends JpaRepository<Board, Long> { | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/com/daon/onjung/suggestion/repository/mysql/CommentRepository.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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.daon.onjung.suggestion.repository.mysql; | ||
|
||
import com.daon.onjung.suggestion.domain.Comment; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface CommentRepository extends JpaRepository<Comment, Long> { | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/com/daon/onjung/suggestion/repository/mysql/LikeRepository.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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.daon.onjung.suggestion.repository.mysql; | ||
|
||
import com.daon.onjung.suggestion.domain.Like; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface LikeRepository extends JpaRepository<Like, Long> { | ||
} |