Skip to content

Commit e638ba9

Browse files
committed
feat : 엔티티 생성
1 parent f7fc4a9 commit e638ba9

File tree

4 files changed

+145
-0
lines changed

4 files changed

+145
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package com.embitips.conversation;
2+
3+
import com.embitips.user.User;
4+
import com.embitips.virtualfriend.VirtualFriend;
5+
import jakarta.persistence.*;
6+
import lombok.Getter;
7+
import lombok.Setter;
8+
9+
import java.time.LocalDateTime;
10+
11+
@Entity
12+
@Getter
13+
@Setter
14+
@Table(name = "conversation")
15+
16+
public class Conversation {
17+
@Id
18+
@GeneratedValue(strategy = GenerationType.IDENTITY)
19+
private Long conversationId;
20+
21+
@ManyToOne(fetch = FetchType.LAZY)
22+
@JoinColumn(name = "user_id", nullable = false)
23+
private User user;
24+
25+
@ManyToOne(fetch = FetchType.LAZY)
26+
@JoinColumn(name = "virtual_friend_id", nullable = false)
27+
private VirtualFriend virtualFriend;
28+
29+
@Column(nullable = false)
30+
private LocalDateTime createdAt;
31+
32+
@Column(nullable = false)
33+
private LocalDateTime updatedAt;
34+
35+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package com.embitips.message;
2+
3+
import com.embitips.conversation.Conversation;
4+
import com.embitips.user.User;
5+
import com.embitips.virtualfriend.VirtualFriend;
6+
import jakarta.persistence.*;
7+
import lombok.Getter;
8+
import lombok.Setter;
9+
10+
import java.time.LocalDateTime;
11+
12+
@Entity
13+
@Getter
14+
@Setter
15+
@Table(name = "message")
16+
public class Message {
17+
18+
@Id
19+
@GeneratedValue(strategy = GenerationType.IDENTITY)
20+
private Long messageId;
21+
22+
@ManyToOne(fetch = FetchType.LAZY)
23+
@JoinColumn(name = "conversation_id", nullable = false)
24+
private Conversation conversation;
25+
26+
@ManyToOne(fetch = FetchType.LAZY)
27+
@JoinColumn(name = "user_id", nullable = false)
28+
private User user;
29+
30+
@ManyToOne(fetch = FetchType.LAZY)
31+
@JoinColumn(name = "virtual_friend_id", nullable = false)
32+
private VirtualFriend virtualFriend;
33+
34+
@Column(length = 500, nullable = false)
35+
private String messageContent;
36+
37+
@Column(nullable = false)
38+
private LocalDateTime
39+
sentAt;
40+
41+
@Column(nullable = false)
42+
private Boolean isRead;
43+
44+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.embitips.user;
2+
3+
import jakarta.persistence.*;
4+
import lombok.Getter;
5+
import lombok.NoArgsConstructor;
6+
import lombok.Setter;
7+
8+
@Entity
9+
@Getter
10+
@Setter
11+
@Table(name = "user")
12+
public class User {
13+
14+
@Id
15+
@GeneratedValue(strategy = GenerationType.IDENTITY)
16+
private Long userId;
17+
18+
@Column(nullable = false, length = 30)
19+
private String userEmail;
20+
}
21+
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package com.embitips.virtualfriend;
2+
3+
import com.embitips.user.User;
4+
import jakarta.persistence.*;
5+
import lombok.Getter;
6+
import lombok.Setter;
7+
8+
@Entity
9+
@Getter
10+
@Setter
11+
@Table(name = "virtual_friend")
12+
public class VirtualFriend {
13+
@Id
14+
@GeneratedValue(strategy = GenerationType.IDENTITY)
15+
private Long virtualFriendId;
16+
17+
@ManyToOne(fetch = FetchType.LAZY)
18+
@JoinColumn(name = "user_id", nullable = false)
19+
private User user;
20+
21+
@Column(nullable = false)
22+
private String eandi;
23+
24+
@Column(nullable = false)
25+
private String nands;
26+
27+
@Column(nullable = false)
28+
private String tandf;
29+
30+
@Column(nullable = false)
31+
private String jandp;
32+
33+
@Column(length = 20)
34+
private String virtualFriendName;
35+
36+
@Column
37+
private int virtualFriendAge;
38+
39+
@Column(length = 4, nullable = false)
40+
private String virtualFriendSex;
41+
42+
@Column(length = 20, nullable = false)
43+
private String virtualFriendRelationship;
44+
}
45+

0 commit comments

Comments
 (0)