Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
4974bf0
[feat] Alias 엔티티 작성 (#11)
hd0rable Jun 1, 2025
7a5a1e8
[feat] AttendanceCheck 엔티티 작성 (#11)
hd0rable Jun 1, 2025
f0961e9
[feat] AttendanceCheck 엔티티 복합키 AttendanceCheckId 작성 (#11)
hd0rable Jun 1, 2025
ff2f5c4
[feat] BaseEntity 작성 (#11)
hd0rable Jun 1, 2025
8707bf3
[feat] Book 엔티티 작성 (#11)
hd0rable Jun 1, 2025
f88e91a
[chore] db 의존성 변경
hd0rable Jun 1, 2025
52b5d90
[feat] Category 엔티티 작성 (#11)
hd0rable Jun 1, 2025
12d9e12
[feat] Comment 엔티티 작성 (#11)
hd0rable Jun 1, 2025
a93a7cc
[feat] CommentLike 엔티티 작성 (#11)
hd0rable Jun 1, 2025
1de7e34
[feat] Contents 엔티티 작성 (#11)
hd0rable Jun 1, 2025
afef83a
[feat] EntityStatus 작성 (#11)
hd0rable Jun 1, 2025
57c5025
[feat] Feed 엔티티 작성 (#11)
hd0rable Jun 1, 2025
f0c4487
[feat] Following 엔티티 작성 (#11)
hd0rable Jun 1, 2025
2e96448
[feat] Following 엔티티 복합키 FollowingId 작성 (#11)
hd0rable Jun 1, 2025
31efe2e
[feat] Notification 엔티티 작성 (#11)
hd0rable Jun 1, 2025
7a58a3d
[feat] Post 엔티티 작성 (#11)
hd0rable Jun 1, 2025
e293a53
[feat] PostLike 엔티티 작성 (#11)
hd0rable Jun 1, 2025
eab7a0f
[feat] RecentSearch 엔티티 작성 (#11)
hd0rable Jun 1, 2025
b10935a
[feat] Record 엔티티 작성 (#11)
hd0rable Jun 1, 2025
99e3667
[feat] Room 엔티티 작성 (#11)
hd0rable Jun 1, 2025
1d43021
[feat] SavedBook 엔티티 작성 (#11)
hd0rable Jun 1, 2025
a7537e2
[feat] SavedFeed 엔티티 작성 (#11)
hd0rable Jun 1, 2025
b5048d2
[feat] SearchType enum 작성 (#11)
hd0rable Jun 1, 2025
03c5c9e
[feat] UserRole enum 작성 (#11)
hd0rable Jun 1, 2025
f6b449a
[feat] Tag 엔티티 작성 (#11)
hd0rable Jun 1, 2025
193811a
[feat] User 엔티티 작성 (#11)
hd0rable Jun 1, 2025
b290a11
[feat] UserRoom 엔티티 작성 (#11)
hd0rable Jun 1, 2025
395446e
[feat] UserRoom 엔티티 복합키 UserRoomId 작성 (#11)
hd0rable Jun 1, 2025
915ebf9
[feat] UserVote 엔티티 복합키 UserVoteId 작성 (#11)
hd0rable Jun 1, 2025
585c31b
[feat] UserVote 엔티티 작성 (#11)
hd0rable Jun 1, 2025
c967355
[feat] Vote 엔티티 작성 (#11)
hd0rable Jun 1, 2025
9e50df9
[feat] VoteItem 엔티티 작성 (#11)
hd0rable Jun 1, 2025
2850feb
[chore] Record extends BaseEntity
hd0rable Jun 1, 2025
6c4ce1e
[chore] value값 Column name 수정 (#11)
hd0rable Jun 1, 2025
286db68
[chore] 클래스명 JpaEntity 추가작성 (#11)
hd0rable Jun 1, 2025
22045d7
[chore] 테이블 메스드명 같이 바뀐거 수정 (#11)
hd0rable Jun 1, 2025
6cbdd5c
[chore] 테이블 메스드명 같이 바뀐거 수정 (#11)
hd0rable Jun 1, 2025
86eff6d
[chore] 카테고리-칭호 일대일매핑 변경 (#11)
hd0rable Jun 2, 2025
85359a6
[refactor] 테이블명 복수 변경 및 매핑관계 클래스 아래쪽에 작성 (#11)
hd0rable Jun 2, 2025
dd4d4d6
[refactor] 테이블명 복수 변경 및 매핑관계 클래스 아래쪽에 작성 및 0 초기화 (#11)
hd0rable Jun 2, 2025
0685757
[refactor] 테이블명 복수 변경 및 매핑관계 클래스 아래쪽에 작성 및 0 초기화, count @ Column(null…
hd0rable Jun 2, 2025
caf6560
[chore] UserRoomRole enum 작성 (#11)
hd0rable Jun 2, 2025
fd44b57
[chore] UserRole enum 수정 (#11)
hd0rable Jun 2, 2025
71c4d84
[chore] 매핑관계 동일 필드명으로 발생한 문제 수정 (#11)
hd0rable Jun 2, 2025
db267dc
[refactor] new ArrayList<>() @ Builder.Default로 초기화 (#11)
hd0rable Jun 2, 2025
153b41b
[chore] alias_id pk 중복매핑 수정 @ MapsId 삭제(#11)
hd0rable Jun 2, 2025
5cc004b
[chore] Alias-Category 단방향 매핑으로 수정 (#11)
hd0rable Jun 2, 2025
282a597
[chore] 일대일 매핑관련 fk 중복이름 관련 문제 수정 (#11)
hd0rable Jun 2, 2025
445d138
[chore] Alias-Category, Alias-user 단방향 매핑으로 수정 (#11)
hd0rable Jun 2, 2025
e361dc4
[refactor] ci-workflow 클린하고 빌드로 수정
hd0rable Jun 2, 2025
fd695ec
[chore] 원래 빌드로 수정
hd0rable Jun 2, 2025
6b99f15
Merge remote-tracking branch 'origin/develop' into chore/#11-jpa-entity
hd0rable Jun 2, 2025
1835fb6
[rename] 패키지 구조에 맞게 jpa entity 파일 이동
hd0rable Jun 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 43 additions & 5 deletions src/main/java/konkuk/thip/book/adapter/out/jpa/BookJpaEntity.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,49 @@
package konkuk.thip.book.adapter.out.jpa;

import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.*;
import konkuk.thip.room.adapter.out.jpa.RoomJpaEntity;
import konkuk.thip.global.entity.BaseJpaEntity;
import lombok.*;

import java.util.ArrayList;
import java.util.List;

@Entity
public class BookJpaEntity {
@Table(name = "books")
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
@Builder
public class BookJpaEntity extends BaseJpaEntity {

@Id
private Long id;
}
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long bookId;

@Column(length = 100, nullable = false)
private String title;

@Column(length = 13, nullable = false, unique = true)
private String isbn;

@Column(name = "author_name",length = 50, nullable = false)
private String authorName;

@Column(name = "best_seller",nullable = false)
private boolean bestSeller;

private String publisher;

@Column(name = "image_url",columnDefinition = "TEXT", nullable = false)
private String imageUrl;

@Column(name = "page_count")
private Integer pageCount;

@Column(length = 1000)
private String description;

@Builder.Default
@OneToMany(mappedBy = "bookJpaEntity", cascade = CascadeType.ALL, orphanRemoval = true)
private List<RoomJpaEntity> roomJpaEntities = new ArrayList<>();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package konkuk.thip.book.adapter.out.jpa;

import jakarta.persistence.*;
import konkuk.thip.user.adapter.out.jpa.AliasJpaEntity;
import konkuk.thip.feed.adapter.out.jpa.TagJpaEntity;
import konkuk.thip.global.entity.BaseJpaEntity;
import lombok.*;

import java.util.ArrayList;
import java.util.List;


@Entity
@Table(name = "categories")
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
@Builder
public class CategoryJpaEntity extends BaseJpaEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "category_id")
private Long categoryId;

@Column(name = "category_value",length = 50, nullable = false)
private String value;

@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "category_alias_id", nullable = false)
private AliasJpaEntity aliasForCategoryJpaEntity;

@Builder.Default
@OneToMany(mappedBy = "categoryJpaEntity", cascade = CascadeType.ALL, orphanRemoval = true)
private List<TagJpaEntity> tagJpaEntities = new ArrayList<>();
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,47 @@
package konkuk.thip.comment.adapter.out.jpa;

import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.*;
import konkuk.thip.room.adapter.out.jpa.PostJpaEntity;
import konkuk.thip.user.adapter.out.jpa.UserJpaEntity;
import konkuk.thip.global.entity.BaseJpaEntity;
import lombok.*;

import java.util.ArrayList;
import java.util.List;

@Entity
public class CommentJpaEntity {
@Table(name = "comments")
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
@Builder
public class CommentJpaEntity extends BaseJpaEntity {

@Id
private Long id;
}
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "comment_id")
private Long commentId;

@Column(length = 650, nullable = false)
private String content;

@Builder.Default
@Column(name = "report_count", nullable = false)
private int reportCount = 0;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "post_id", nullable = false)
private PostJpaEntity postJpaEntity;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id", nullable = false)
private UserJpaEntity userJpaEntity;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "parent_id")
private CommentJpaEntity parent;

@Builder.Default
@OneToMany(mappedBy = "parent", cascade = CascadeType.ALL, orphanRemoval = true)
private List<CommentJpaEntity> children = new ArrayList<>();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package konkuk.thip.comment.adapter.out.jpa;

import jakarta.persistence.*;
import konkuk.thip.user.adapter.out.jpa.UserJpaEntity;
import konkuk.thip.global.entity.BaseJpaEntity;
import lombok.*;


@Entity
@Table(name = "comment_likes")
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
@Builder
public class CommentLikeJpaEntity extends BaseJpaEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long likeId;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id")
private UserJpaEntity userJpaEntity;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "comment_id")
private CommentJpaEntity commentJpaEntity;
}
36 changes: 31 additions & 5 deletions src/main/java/konkuk/thip/feed/adapter/out/jpa/FeedJpaEntity.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,37 @@

package konkuk.thip.feed.adapter.out.jpa;

import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.*;
import konkuk.thip.book.adapter.out.jpa.BookJpaEntity;
import konkuk.thip.room.adapter.out.jpa.PostJpaEntity;
import konkuk.thip.global.entity.BaseJpaEntity;
import lombok.*;

@Entity
public class FeedJpaEntity {
@Table(name = "feeds")
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
@Builder
public class FeedJpaEntity extends BaseJpaEntity {

@Id
private Long id;
}
@Column(name = "post_id")
private Long postId;

@Column(name = "is_public", nullable = false)
private Boolean isPublic;

@Builder.Default
@Column(name = "report_count", nullable = false)
private int reportCount = 0;

@MapsId
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "post_id")
private PostJpaEntity postJpaEntity;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "book_id", nullable = false)
private BookJpaEntity bookJpaEntity;
}
32 changes: 32 additions & 0 deletions src/main/java/konkuk/thip/feed/adapter/out/jpa/TagJpaEntity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package konkuk.thip.feed.adapter.out.jpa;

import jakarta.persistence.*;
import konkuk.thip.book.adapter.out.jpa.CategoryJpaEntity;
import konkuk.thip.room.adapter.out.jpa.PostJpaEntity;
import konkuk.thip.global.entity.BaseJpaEntity;
import lombok.*;

@Entity
@Table(name = "tags")
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
@Builder
public class TagJpaEntity extends BaseJpaEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "tag_id")
private Long tagId;

@Column(name = "tag_value",length = 50, nullable = false)
private String value;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "post_id", nullable = false)
private PostJpaEntity postJpaEntity;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "category_id", nullable = false)
private CategoryJpaEntity categoryJpaEntity;
}
41 changes: 41 additions & 0 deletions src/main/java/konkuk/thip/global/entity/BaseJpaEntity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package konkuk.thip.global.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import java.time.LocalDateTime;

@Getter
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
public abstract class BaseJpaEntity {

@CreatedDate
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonSerialize(using = LocalDateSerializer.class)
@JsonDeserialize(using = LocalDateDeserializer.class)
@Column(name = "created_at",nullable = false, updatable = false)
private LocalDateTime createdAt;

@Setter
@LastModifiedDate
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonSerialize(using = LocalDateSerializer.class)
@JsonDeserialize(using = LocalDateDeserializer.class)
@Column(name = "modified_at",nullable = false)
private LocalDateTime modifiedAt;

@Setter
@Enumerated(EnumType.STRING)
@Column(nullable = false)
private JpaEntityStatus status = JpaEntityStatus.ACTIVE;
}
5 changes: 5 additions & 0 deletions src/main/java/konkuk/thip/global/entity/JpaEntityStatus.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package konkuk.thip.global.entity;

public enum JpaEntityStatus {
ACTIVE, INACTIVE, EXPIRED
}
Comment on lines +1 to +5
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package konkuk.thip.room.adapter.out.jpa;

import jakarta.persistence.*;
import konkuk.thip.global.entity.BaseJpaEntity;
import lombok.*;


@Entity
@Table(name = "contents")
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
@Builder
public class ContentJpaEntity extends BaseJpaEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long contentId;

@Column(name = "content_url",columnDefinition = "TEXT", nullable = false)
private String contentUrl;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "post_id", nullable = false)
private PostJpaEntity postJpaEntity;
}
46 changes: 46 additions & 0 deletions src/main/java/konkuk/thip/room/adapter/out/jpa/PostJpaEntity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package konkuk.thip.room.adapter.out.jpa;

import jakarta.persistence.*;
import konkuk.thip.feed.adapter.out.jpa.FeedJpaEntity;
import konkuk.thip.feed.adapter.out.jpa.TagJpaEntity;
import konkuk.thip.global.entity.BaseJpaEntity;
import konkuk.thip.user.adapter.out.jpa.UserJpaEntity;
import lombok.*;

import java.util.ArrayList;
import java.util.List;

@Entity
@Table(name = "posts")
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
@Builder
public class PostJpaEntity extends BaseJpaEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "post_id")
private Long postId;

@Column(length = 6100, nullable = false)
private String content;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id", nullable = false)
private UserJpaEntity userJpaEntity;

@OneToOne(mappedBy = "postJpaEntity", cascade = CascadeType.ALL, orphanRemoval = true)
private FeedJpaEntity feedJpaEntity;

@OneToOne(mappedBy = "postJpaEntity", cascade = CascadeType.ALL, orphanRemoval = true)
private VoteJpaEntity voteJpaEntity;

@OneToOne(mappedBy = "postJpaEntity", cascade = CascadeType.ALL, orphanRemoval = true)
private RecordJpaEntity recordJpaEntity;

@Builder.Default
@OneToMany(mappedBy = "postJpaEntity", cascade = CascadeType.ALL, orphanRemoval = true)
private List<TagJpaEntity> tagJpaEntities = new ArrayList<>();

}
Loading