-
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.
- Loading branch information
Showing
11 changed files
with
341 additions
and
1 deletion.
There are no files selected for viewing
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,24 @@ | ||
package com.umc.dream.domain; | ||
|
||
import com.umc.dream.domain.common.BaseEntity; | ||
import jakarta.persistence.*; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class Character extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "dream_id", nullable = false) | ||
private Dream dream; | ||
|
||
@Column(nullable = false, length = 100) | ||
private String name; | ||
} |
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,39 @@ | ||
package com.umc.dream.domain; | ||
|
||
import com.umc.dream.domain.common.BaseEntity; | ||
import jakarta.persistence.*; | ||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import static jakarta.persistence.FetchType.*; | ||
|
||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class Comment extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(nullable = false) | ||
private String reply; | ||
|
||
@ManyToOne(fetch = LAZY) | ||
@JoinColumn(name = "post_id") | ||
private Post post; | ||
|
||
@ManyToOne(fetch = LAZY) | ||
@JoinColumn(name = "writer_id") | ||
private User user; | ||
|
||
@Builder | ||
public Comment(String reply, Post post, User user) { | ||
this.reply = reply; | ||
this.post = post; | ||
this.user = user; | ||
} | ||
} |
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,51 @@ | ||
package com.umc.dream.domain; | ||
|
||
import com.umc.dream.domain.common.BaseEntity; | ||
import com.umc.dream.domain.enums.DreamCategory; | ||
import jakarta.persistence.*; | ||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.time.LocalDate; | ||
import java.time.LocalDateTime; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class Dream extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "users_id", nullable = false) | ||
private User user; | ||
|
||
private LocalDate date; | ||
|
||
private LocalDateTime sleepTime; | ||
|
||
private LocalDateTime wakeUpTime; | ||
|
||
@Column(nullable = false, length = 100) | ||
private String title; | ||
|
||
private String content; | ||
|
||
@Enumerated(EnumType.STRING) | ||
private DreamCategory category; | ||
|
||
@Builder | ||
public Dream(User user, LocalDate date, LocalDateTime sleepTime, LocalDateTime wakeUpTime, String title, String content, DreamCategory category) { | ||
this.user = user; | ||
this.date = date; | ||
this.sleepTime = sleepTime; | ||
this.wakeUpTime = wakeUpTime; | ||
this.title = title; | ||
this.content = content; | ||
this.category = category; | ||
} | ||
} |
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,34 @@ | ||
package com.umc.dream.domain; | ||
|
||
import com.umc.dream.domain.common.BaseEntity; | ||
import jakarta.persistence.*; | ||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import static jakarta.persistence.FetchType.*; | ||
|
||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class Feeling extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(nullable = false) | ||
private String feel; | ||
|
||
@ManyToOne(fetch = LAZY) | ||
@JoinColumn(name = "dream_id") | ||
private Dream dream; | ||
|
||
@Builder | ||
public Feeling(String feel, Dream dream) { | ||
this.feel = feel; | ||
this.dream = dream; | ||
} | ||
} |
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,34 @@ | ||
package com.umc.dream.domain; | ||
|
||
import com.umc.dream.domain.common.BaseEntity; | ||
import jakarta.persistence.*; | ||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import static jakarta.persistence.FetchType.*; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class Follow extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@ManyToOne(fetch = LAZY) | ||
@JoinColumn(name = "follower_id") | ||
private User follower; // 친추 거는 사람 | ||
|
||
@ManyToOne(fetch = LAZY) | ||
@JoinColumn(name = "acceptor_id") | ||
private User acceptor; // 친추 당하는 사람 | ||
|
||
@Builder | ||
public Follow(User follower, User acceptor) { | ||
this.follower = follower; | ||
this.acceptor = acceptor; | ||
} | ||
} |
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,34 @@ | ||
package com.umc.dream.domain; | ||
|
||
import com.umc.dream.domain.common.BaseEntity; | ||
import jakarta.persistence.*; | ||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import static jakarta.persistence.FetchType.*; | ||
|
||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class Hashtag extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(nullable = false) | ||
private String tag; | ||
|
||
@ManyToOne(fetch = LAZY) | ||
@JoinColumn(name = "dream_id") | ||
private Dream dream; | ||
|
||
@Builder | ||
public Hashtag(String tag, Dream dream) { | ||
this.tag = tag; | ||
this.dream = dream; | ||
} | ||
} |
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,24 @@ | ||
package com.umc.dream.domain; | ||
|
||
import com.umc.dream.domain.common.BaseEntity; | ||
import jakarta.persistence.*; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class Place extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "dream_id", nullable = false) | ||
private Dream dream; | ||
|
||
@Column(nullable = false, length = 30) | ||
private String location; | ||
} |
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,56 @@ | ||
package com.umc.dream.domain; | ||
|
||
import com.umc.dream.domain.enums.Type; | ||
import jakarta.persistence.*; | ||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import static jakarta.persistence.FetchType.*; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class Post { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
private String title; | ||
|
||
@Column(columnDefinition = "TEXT") | ||
private String content; | ||
|
||
@Enumerated(EnumType.STRING) | ||
private Type type; | ||
|
||
@ManyToOne(fetch = LAZY) | ||
@JoinColumn(name = "writer_id") | ||
private User writer; | ||
|
||
@ManyToOne(fetch = LAZY) | ||
@JoinColumn(name = "pro_id") | ||
private User pro; | ||
|
||
@ManyToOne(fetch = LAZY) | ||
@JoinColumn(name = "dream_id") | ||
private Dream dream; | ||
|
||
@OneToMany(mappedBy = "post", cascade = CascadeType.ALL) | ||
private List<Comment> commentList = new ArrayList<>(); | ||
|
||
@Builder | ||
public Post(String title, String content, Type type, User writer, User pro, Dream dream) { | ||
this.title = title; | ||
this.content = content; | ||
this.type = type; | ||
this.writer = writer; | ||
this.pro = pro; | ||
this.dream = dream; | ||
} | ||
} |
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
32 changes: 32 additions & 0 deletions
32
src/main/java/com/umc/dream/domain/enums/DreamCategory.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,32 @@ | ||
package com.umc.dream.domain.enums; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonValue; | ||
import lombok.Getter; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Getter | ||
@Slf4j | ||
public enum DreamCategory { | ||
NORMAL("일반"), | ||
SOSO("그냥그래요"), | ||
GOOD("온수가 빨라요"); | ||
|
||
@JsonValue | ||
private final String value; | ||
|
||
DreamCategory(String value) { | ||
this.value = value; | ||
} | ||
|
||
@JsonCreator // Json -> Object, 역직렬화 수행하는 메서드 | ||
public static DreamCategory from(String param) { | ||
for (DreamCategory dreamCategory : DreamCategory.values()) { | ||
if (dreamCategory.getValue().equals(param)) { | ||
return dreamCategory; | ||
} | ||
} | ||
log.debug("HotWaterStatus.from() exception occur param: {}", param); | ||
return null; | ||
} | ||
} |
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,5 @@ | ||
package com.umc.dream.domain.enums; | ||
|
||
public enum Type { | ||
COMMUNITY, PRO, FRIENDS | ||
} |