Skip to content

Commit

Permalink
Merge pull request #31 from Kernel360/feature/board-entity-update-#29
Browse files Browse the repository at this point in the history
Feature/board entity update #29
  • Loading branch information
jeongns2611 authored Jan 3, 2025
2 parents 3ca7bf1 + 20d1b2c commit f684691
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 277 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.seveneleven.devlens.domain.board.dto;

import lombok.Getter;

@Getter
public enum PostStatus {

DEFAULT("선택"),
IN_PROGRESS("진행"),
ADDITION("추가"),
COMPLETED("완료"),
ON_HOLD("보류");

private final String description;

PostStatus(String description) {
this.description = description;
}

// 사용할지 고민
// FEEDBACK("피드백"),
// REQUESTED("요청");
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,17 @@

@Entity
@Getter
@Setter
@ToString
@Builder(toBuilder = true)
@NoArgsConstructor
@AllArgsConstructor(access = AccessLevel.PRIVATE)
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Table(name = "comment")
public class Comment extends BaseEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "comment_id")
private Long commentId; // 댓글 ID
@Column(name = "id")
private Long id; // 댓글 ID

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "post_id", nullable = false)
@JoinColumn(name = "post_id", nullable = false, referencedColumnName = "id")
private Post postId; // 게시물 ID

@JoinColumn(name = "parent_comment_id")
Expand All @@ -36,23 +32,10 @@ public class Comment extends BaseEntity {
@Column(name = "content", nullable = false, columnDefinition = "TEXT")
private String content; // 내용

@JoinColumn(name = "register_id", nullable = false, referencedColumnName = "id")
@ManyToOne(fetch = FetchType.LAZY)
private Member registerId;

@Column(name = "register_ip", length = 50)
private String registerIp; // 등록자 IP

@Column(name = "registered_date")
private LocalDateTime registeredDate; // 등록일

@JoinColumn(name = "modifier_id", nullable = false, referencedColumnName = "id")
@ManyToOne(fetch = FetchType.LAZY)
private Member modifierId; // 수정자

@Column(name = "modified_date")
private LocalDateTime modifiedDate; // 등록일

@Column(name = "modifier_ip", length = 50)
private String modifierIp; // 수정자 IP

}
53 changes: 17 additions & 36 deletions src/main/java/com/seveneleven/devlens/domain/board/entity/Post.java
Original file line number Diff line number Diff line change
@@ -1,45 +1,40 @@
package com.seveneleven.devlens.domain.board.entity;

import com.seveneleven.devlens.domain.member.entity.Member;
import com.seveneleven.devlens.domain.board.dto.PostStatus;
import com.seveneleven.devlens.domain.project.entity.ProjectStep;
import com.seveneleven.devlens.global.entity.BaseEntity;
import jakarta.persistence.*;
import lombok.*;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;

import java.time.LocalDateTime;
import java.time.LocalDate;

@Entity
@Getter
@Setter
@ToString
@Builder(toBuilder = true)
@NoArgsConstructor
@AllArgsConstructor(access = AccessLevel.PRIVATE)
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Table(name = "post")
public class Post extends BaseEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "post_id")
private Long postId; // 게시물 ID
@Column(name = "id")
private Long id; // 게시물 ID (문서번호)

@JoinColumn(name = "project_step_id", nullable = false)
@JoinColumn(name = "project_step_id", nullable = false, referencedColumnName = "id")
@ManyToOne(fetch = FetchType.LAZY)
private ProjectStep projectStepId; // 프로젝트 단계 ID

@JoinColumn(name = "parent_post_id")
@JoinColumn(name = "parent_post_id", referencedColumnName = "id")
@ManyToOne(fetch = FetchType.LAZY)
private Post parentPostId; // 부모 게시물 ID

@Column(name = "is_pinned_post")
private Boolean isPinnedPost; // 고정 여부
private Boolean isPinnedPost; // 상단고정 여부

@Column(name = "priority")
private Integer priority; // 우선순위 (1,2,3)

@Column(name = "status", nullable = false, length = 50)
private String status; // 상태 (요청, 진행, 피드백, 완료, 보류)
private PostStatus status; // 상태 (선택(기본값), 진행, 추가, 완료, 보류)

@Column(name = "title", nullable = false, length = 255)
private String title; // 제목
Expand All @@ -53,27 +48,13 @@ public class Post extends BaseEntity {
@Column(name = "has_link", nullable = false)
private Boolean hasLink; // 링크 유무

@CreatedBy
@JoinColumn(name = "register_id", nullable = false, referencedColumnName = "id")
@ManyToOne(fetch = FetchType.LAZY)
private Member registerId;

@Column(name = "registered_ip", length = 50)
private String registeredIp; // 등록자 IP
@Column(name = "deadline")
private LocalDate deadline; // 마감일자

@CreatedDate
@Column(name = "registered_date")
private LocalDateTime registeredDate; // 등록일

@LastModifiedBy
@JoinColumn(name = "modified_id", nullable = false, referencedColumnName = "id")
@ManyToOne(fetch = FetchType.LAZY)
private Member modifier; // 수정자

@LastModifiedDate
@Column(name = "modified_date")
private LocalDateTime modifiedDate; // 수정일
@Column(name = "register_ip", length = 50)
private String registerIp; // 등록자 IP

@Column(name = "modifier_ip", length = 50)
private String modifierIp; // 수정자 IP

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.seveneleven.devlens.domain.board.entity;

import com.seveneleven.devlens.domain.board.dto.PostStatus;
import com.seveneleven.devlens.domain.member.entity.Member;
import com.seveneleven.devlens.domain.project.entity.ProjectStep;
import jakarta.persistence.*;
Expand All @@ -9,21 +10,22 @@
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;

import java.time.LocalDate;
import java.time.LocalDateTime;

@Entity
@Getter
@Setter
@ToString
@Builder(toBuilder = true)
@NoArgsConstructor
@AllArgsConstructor(access = AccessLevel.PRIVATE)
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Table(name = "post_history")
public class PostHistory {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "post_history_id")
private Long postHistoryId; // 게시물 ID
@Column(name = "id")
private Long id; // 게시물 이력 ID

@Column(name = "post_id", nullable = false)
private Long postId; // 게시물 ID

@Column(name = "project_step_id", nullable = false)
private Long projectStepId; // 프로젝트 단계 ID
Expand All @@ -32,10 +34,13 @@ public class PostHistory {
private Long parentPostId; // 부모 게시물 ID

@Column(name = "is_pinned_post")
private Boolean isPinnedPost; // 고정 여부
private Boolean isPinnedPost; // 상단고정 여부

@Column(name = "priority")
private Integer priority; // 우선순위 (1,2,3)

@Column(name = "status", nullable = false, length = 50)
private String status; // 상태 (요청, 진행, 피드백, 완료, 보류)
private PostStatus status; // 상태 (선택(기본값), 진행, 추가, 완료, 보류)

@Column(name = "title", nullable = false, length = 255)
private String title; // 제목
Expand All @@ -49,27 +54,13 @@ public class PostHistory {
@Column(name = "has_link", nullable = false)
private Boolean hasLink; // 링크 유무

@CreatedBy
@JoinColumn(name = "register_id", nullable = false, referencedColumnName = "id")
@ManyToOne(fetch = FetchType.LAZY)
private Member registerId;
@Column(name = "deadline")
private LocalDate deadline; // 마감일자

@Column(name = "registered_ip", length = 50)
private String registeredIp; // 등록자 IP

@CreatedDate
@Column(name = "registered_date")
private LocalDateTime registeredDate; // 등록일

@LastModifiedBy
@JoinColumn(name = "modified_id", nullable = false, referencedColumnName = "id")
@ManyToOne(fetch = FetchType.LAZY)
private Member modifier; // 수정자

@LastModifiedDate
@Column(name = "modified_date")
private LocalDateTime modifiedDate; // 등록일

@Column(name = "modifier_ip", length = 50)
private String modifierIp; // 수정자 IP

}
Original file line number Diff line number Diff line change
@@ -1,62 +0,0 @@
package com.seveneleven.devlens.domain.board.entity;

import com.seveneleven.devlens.domain.member.entity.Member;
import com.seveneleven.devlens.global.entity.BaseEntity;
import jakarta.persistence.*;
import lombok.*;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;

import java.time.LocalDateTime;

@Entity
@Getter
@Setter
@ToString
@Builder(toBuilder = true)
@NoArgsConstructor
@AllArgsConstructor(access = AccessLevel.PRIVATE)
@Table(name = "question")
public class Question extends BaseEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "question_id")
private Long questionId; // 질문 ID

@JoinColumn(name = "post_id", nullable = false)
@OneToOne(fetch = FetchType.LAZY)
private Post postId; // 게시물 ID

@Column(name = "question_content", nullable = false, columnDefinition = "TEXT")
private String questionContent; // 질문 내용

@Column(name = "answer_content", columnDefinition = "TEXT")
private String answerContent; // 답변 내용

@CreatedDate
@Column(name = "registered_date", nullable = false, updatable = false)
private LocalDateTime registeredDate; // 등록일시

@LastModifiedDate
@Column(name = "modification_date")
private LocalDateTime modificationDate; // 수정일시

@CreatedBy
@JoinColumn(name = "register_id", updatable = false, referencedColumnName = "id")
@OneToOne(fetch = FetchType.LAZY)
private Member registerId; // 등록자

@LastModifiedBy
@JoinColumn(name = "modified_id", referencedColumnName = "id")
@OneToOne(fetch = FetchType.LAZY)
private Member modifierId; // 수정자

@Column(name = "register_ip", length = 50)
private String registerIp; // 등록자 IP

@Column(name = "modifier_ip", length = 50)
private String modifierIp; // 수정자 IP
}
Loading

0 comments on commit f684691

Please sign in to comment.