Skip to content

Commit

Permalink
chore: column 명 명시적으로 지정
Browse files Browse the repository at this point in the history
  • Loading branch information
geneaky committed Sep 12, 2024
1 parent f420e72 commit 90264d6
Show file tree
Hide file tree
Showing 17 changed files with 228 additions and 167 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,32 @@
@Table(name = "agony")
public class AgonyEntity extends BaseEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String title;
private String hexColorCode;
@Column(name = "book_shelf_id", nullable = false)
private Long bookShelfId;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "title")
private String title;
@Column(name = "hex_color_code")
private String hexColorCode;
@Column(name = "book_shelf_id", nullable = false)
private Long bookShelfId;

@Builder
private AgonyEntity(Long id, String title, String hexColorCode, Long bookShelfId) {
this.id = id;
this.title = title;
this.hexColorCode = hexColorCode;
this.bookShelfId = bookShelfId;
}
@Builder
private AgonyEntity(Long id, String title, String hexColorCode, Long bookShelfId) {
this.id = id;
this.title = title;
this.hexColorCode = hexColorCode;
this.bookShelfId = bookShelfId;
}

protected AgonyEntity() {
}
protected AgonyEntity() {
}

public void changeTitle(String agonyTitle) {
this.title = agonyTitle;
}
public void changeTitle(String agonyTitle) {
this.title = agonyTitle;
}

public void changeHexColorCode(String agonyColor) {
this.hexColorCode = agonyColor;
}
public void changeHexColorCode(String agonyColor) {
this.hexColorCode = agonyColor;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,24 @@
@Table(name = "agony_record")
public class AgonyRecordEntity extends BaseEntity {

@Id
@GeneratedValue(strategy = IDENTITY)
private Long id;
private String title;
private String content;
@Column(name = "agony_id", nullable = false)
private Long agonyId;
@Id
@GeneratedValue(strategy = IDENTITY)
private Long id;
@Column(name = "title")
private String title;
@Column(name = "content")
private String content;
@Column(name = "agony_id", nullable = false)
private Long agonyId;

@Builder
private AgonyRecordEntity(Long id, String title, String content, Long agonyId) {
this.id = id;
this.title = title;
this.content = content;
this.agonyId = agonyId;
}
@Builder
private AgonyRecordEntity(Long id, String title, String content, Long agonyId) {
this.id = id;
this.title = title;
this.content = content;
this.agonyId = agonyId;
}

protected AgonyRecordEntity() {
}
protected AgonyRecordEntity() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CollectionTable;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Table;
import lombok.Builder;
import lombok.Getter;
Expand All @@ -23,13 +25,18 @@ public class BookEntity extends BaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "isbn")
private String isbn;
@Column(name = "title")
private String title;
@Column(name = "publisher")
private String publisher;
@Column(name = "book_cover_image_url")
private String bookCoverImageUrl;
@Column(name = "publish_at")
private LocalDate publishAt;
@ElementCollection(fetch = FetchType.EAGER)
@CollectionTable(name = "book_authors")
@CollectionTable(name = "book_authors", joinColumns = @JoinColumn(name = "book_id"))
private List<String> authors = new ArrayList<>();

@Builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,32 @@
@Table(name = "book_report")
public class BookReportEntity extends BaseEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String title;
private String content;
@Column(name = "book_shelf_id")
private Long bookShelfId;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "title")
private String title;
@Column(name = "content")
private String content;
@Column(name = "book_shelf_id", nullable = false)
private Long bookShelfId;

@Builder
private BookReportEntity(Long id, String title, String content, Long bookShelfId) {
this.id = id;
this.title = title;
this.content = content;
this.bookShelfId = bookShelfId;
}
@Builder
private BookReportEntity(Long id, String title, String content, Long bookShelfId) {
this.id = id;
this.title = title;
this.content = content;
this.bookShelfId = bookShelfId;
}

protected BookReportEntity() {
}
protected BookReportEntity() {
}

public void reviseTitle(String title) {
this.title = title;
}
public void reviseTitle(String title) {
this.title = title;
}

public void reviseContent(String content) {
this.content = content;
}
public void reviseContent(String content) {
this.content = content;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@ public class BookShelfEntity extends BaseEntity {
private Long userId;
@Column(name = "book_id", nullable = false)
private Long bookId;
@Column(name = "pages")
private Integer pages;
@Column(name = "reading_status")
@Enumerated(EnumType.STRING)
private ReadingStatus readingStatus;
@Column(name = "star")
@Enumerated(EnumType.STRING)
private Star star;

Expand Down
41 changes: 21 additions & 20 deletions src/main/java/toy/bookchat/bookchat/db_module/chat/ChatEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,28 @@
@Table(name = "chat")
public class ChatEntity extends BaseEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String message;
@Column(name = "user_id")
private Long userId;
@Column(name = "chat_room_id")
private Long chatRoomId;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "message")
private String message;
@Column(name = "user_id")
private Long userId;
@Column(name = "chat_room_id", nullable = false)
private Long chatRoomId;

protected ChatEntity() {
}
protected ChatEntity() {
}

@Builder
private ChatEntity(Long id, String message, Long userId, Long chatRoomId) {
this.id = id;
this.message = message;
this.userId = userId;
this.chatRoomId = chatRoomId;
}
@Builder
private ChatEntity(Long id, String message, Long userId, Long chatRoomId) {
this.id = id;
this.message = message;
this.userId = userId;
this.chatRoomId = chatRoomId;
}

public String getDispatchTime() {
return getCreatedAt().toString();
}
public String getDispatchTime() {
return getCreatedAt().toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@
@Table(name = "chat_room_blocked_user")
public class ChatRoomBlockedUserEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "user_id")
private Long userId;
@Column(name = "chat_room_id")
private Long chatRoomId;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "user_id", nullable = false)
private Long userId;
@Column(name = "chat_room_id", nullable = false)
private Long chatRoomId;

protected ChatRoomBlockedUserEntity() {
}
protected ChatRoomBlockedUserEntity() {
}

@Builder
private ChatRoomBlockedUserEntity(Long id, Long userId, Long chatRoomId) {
this.id = id;
this.userId = userId;
this.chatRoomId = chatRoomId;
}
@Builder
private ChatRoomBlockedUserEntity(Long id, Long userId, Long chatRoomId) {
this.id = id;
this.userId = userId;
this.chatRoomId = chatRoomId;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,17 @@ public class ChatRoomEntity extends BaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "book_id")
@Column(name = "book_id", nullable = false)
private Long bookId;
@Column(name = "room_name")
private String roomName;
@Column(name = "room_sid")
private String roomSid;
@Column(name = "room_size")
private Integer roomSize;
@Column(name = "default_room_image_type")
private Integer defaultRoomImageType;
@Column(name = "room_image_uri")
private String roomImageUri;

@Builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ public class ChatRoomHashTagEntity extends BaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "chat_room_id")
@Column(name = "chat_room_id", nullable = false)
private Long chatRoomId;
@Column(name = "hash_tag_id")
@Column(name = "hash_tag_id", nullable = false)
private Long hashTagId;

protected ChatRoomHashTagEntity() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package toy.bookchat.bookchat.db_module.chatroom;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
Expand All @@ -13,19 +14,20 @@
@Table(name = "hash_tag")
public class HashTagEntity extends BaseEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String tagName;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "tag_name")
private String tagName;

protected HashTagEntity() {
}
protected HashTagEntity() {
}

private HashTagEntity(String tagName) {
this.tagName = tagName;
}
private HashTagEntity(String tagName) {
this.tagName = tagName;
}

public static HashTagEntity of(String tagName) {
return new HashTagEntity(tagName);
}
public static HashTagEntity of(String tagName) {
return new HashTagEntity(tagName);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ public class DeviceEntity extends BaseEntity {
private Long id;
@Column(name = "user_id", nullable = false)
private Long userId;
@Column(name = "device_token")
private String deviceToken;
@Column(name = "fcm_token")
private String fcmToken;

@Builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ public class ParticipantEntity {
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Enumerated(EnumType.STRING)
@Column(nullable = false)
@Column(name = "participant_status", nullable = false)
private ParticipantStatus participantStatus;
@Column(name = "user_id")
@Column(name = "user_id", nullable = false)
private Long userId;
@Column(name = "chat_room_id")
@Column(name = "chat_room_id", nullable = false)
private Long chatRoomId;
@Column(name = "is_connected")
private Boolean isConnected;

protected ParticipantEntity() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class ScrapEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "scrap_content")
private String scrapContent;
@Column(name = "book_shelf_id", nullable = false)
private Long bookShelfId;
Expand Down
Loading

0 comments on commit 90264d6

Please sign in to comment.