-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create default entities - mk3058 #14
Open
mk3058
wants to merge
19
commits into
dev
Choose a base branch
from
feat/#12-mk3058
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
a280750
feat(domain): college, invite, user, relation, tag, attachment 관련 엔티티 추가
mk3058 c65be37
feat(domain): add default entities
mk3058 45b31eb
refactor: 일부 잘못된 패키지 경로 수정. 패키지/클래스 이름 수정
mk3058 ffc3874
refactor(entity): 문자열 컬럼 길이 지정, 일부 생성자 값 검즘 추가
mk3058 3b13bba
refactor(dto): Request Dto protected 생성자 추가
mk3058 deb1214
refactor: domain계층이 presentation계층에 의존하지 않도록 수정
mk3058 a241e1a
fix(user): 유저의 나이가 20-30 범위로 제한되도록 수정
mk3058 b650a6e
refactor(dto): dto 이름 수정
mk3058 da54071
fix(User): 참조 타입에 대한 값 검증 추가
mk3058 34ce3d8
refactor(matchpost): 패키지 이름 수정
mk3058 37bfa4e
fix(User): 나이 검증 조건 수정
mk3058 65fdd5c
feat(chat): 기본 클래스 추가
mk3058 5746534
feat(college): 기본 클래스 추가
mk3058 6205617
feat(invite): 기본 클래스 추가
mk3058 2a734f1
feat(matchPost): 기본 클래스 추가
mk3058 2e41c43
feat(relation): 기본 클래스 추가
mk3058 26a257c
fix(matchPost): MatchServicePost 클래스를 순환 참조하던 문제 수정
mk3058 426437b
feat(tag): 기본 클래스 추가
mk3058 bffdf80
feat(user): 기본 클래스 추가
mk3058 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
src/main/java/com/sequence/anonymous/chat/domain/Chat.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.sequence.anonymous.chat.domain; | ||
|
||
import com.google.common.base.Preconditions; | ||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import java.util.UUID; | ||
import lombok.Getter; | ||
|
||
@Entity | ||
@Getter | ||
public class Chat { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(nullable = false, unique = true) | ||
private UUID chatIdentifier; | ||
|
||
protected Chat() { | ||
} | ||
|
||
public Chat(UUID chatIdentifier) { | ||
Preconditions.checkArgument(chatIdentifier != null, "chatIdentifier must be provided"); | ||
|
||
this.id = null; | ||
this.chatIdentifier = chatIdentifier; | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
src/main/java/com/sequence/anonymous/college/domain/College.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,42 @@ | ||
package com.sequence.anonymous.college.domain; | ||
|
||
import com.google.common.base.Preconditions; | ||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import lombok.Getter; | ||
import org.apache.commons.lang3.ObjectUtils; | ||
import org.springframework.data.geo.Point; | ||
|
||
@Entity | ||
@Getter | ||
public class College { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(length = 20, nullable = false, unique = true) | ||
private String name; | ||
|
||
private Point location; | ||
|
||
protected College() { | ||
} | ||
|
||
public College(String name, Point location) { | ||
Preconditions.checkArgument(name != null, "name must be provided"); | ||
Preconditions.checkArgument(location != null, "location must be provided"); | ||
|
||
this.id = null; | ||
this.name = name; | ||
this.location = location; | ||
} | ||
|
||
public void update(String name, Point location) { | ||
this.name = ObjectUtils.defaultIfNull(name, this.name); | ||
this.location = ObjectUtils.defaultIfNull(location, this.location); | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
src/main/java/com/sequence/anonymous/college/domain/Department.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,44 @@ | ||
package com.sequence.anonymous.college.domain; | ||
|
||
import com.google.common.base.Preconditions; | ||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.ManyToOne; | ||
import lombok.Getter; | ||
import org.apache.commons.lang3.ObjectUtils; | ||
|
||
@Entity | ||
@Getter | ||
public class Department { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(length = 30, nullable = false) | ||
private String name; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "college_id") | ||
private College college; | ||
|
||
protected Department() { | ||
} | ||
|
||
public Department(String name, College college) { | ||
Preconditions.checkArgument(name != null, "name must be provided"); | ||
Preconditions.checkArgument(college != null, "college must be provided"); | ||
|
||
this.id = null; | ||
this.name = name; | ||
this.college = college; | ||
} | ||
|
||
public void update(String name) { | ||
this.name = ObjectUtils.defaultIfNull(name, this.name); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/com/sequence/anonymous/college/presentation/dto/DepartmentUpdateDto.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,12 @@ | ||
package com.sequence.anonymous.college.presentation.dto; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public class DepartmentUpdateDto { | ||
|
||
private String name; | ||
|
||
protected DepartmentUpdateDto() { | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
src/main/java/com/sequence/anonymous/college/presentation/dto/UpdateDto.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,15 @@ | ||
package com.sequence.anonymous.college.presentation.dto; | ||
|
||
import lombok.Getter; | ||
import org.springframework.data.geo.Point; | ||
|
||
@Getter | ||
public class UpdateDto { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 해당 ex) |
||
|
||
private String name; | ||
|
||
private Point location; | ||
|
||
protected UpdateDto() { | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/com/sequence/anonymous/common/BaseTimeEntity.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,23 @@ | ||
package com.sequence.anonymous.common; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.EntityListeners; | ||
import jakarta.persistence.MappedSuperclass; | ||
import java.time.LocalDateTime; | ||
import lombok.Getter; | ||
import org.springframework.data.annotation.CreatedDate; | ||
import org.springframework.data.annotation.LastModifiedDate; | ||
import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
|
||
@Getter | ||
@MappedSuperclass | ||
@EntityListeners(AuditingEntityListener.class) | ||
public abstract class BaseTimeEntity { | ||
|
||
@CreatedDate | ||
@Column(updatable = false) | ||
private LocalDateTime createdAt; | ||
|
||
@LastModifiedDate | ||
private LocalDateTime updatedAt; | ||
} |
64 changes: 64 additions & 0 deletions
64
src/main/java/com/sequence/anonymous/invite/domain/Invite.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,64 @@ | ||
package com.sequence.anonymous.invite.domain; | ||
|
||
import com.google.common.base.Preconditions; | ||
import com.sequence.anonymous.user.domain.User; | ||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.EnumType; | ||
import jakarta.persistence.Enumerated; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.ManyToOne; | ||
import lombok.Getter; | ||
import org.apache.commons.lang3.ObjectUtils; | ||
|
||
@Entity | ||
@Getter | ||
public class Invite { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "inviter_id") | ||
private User inviter; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "invitee_id") | ||
private User invitee; | ||
|
||
@Column(length = 10) | ||
@Enumerated(EnumType.STRING) | ||
private Status status; | ||
|
||
|
||
@Column(length = 15) | ||
@Enumerated(EnumType.STRING) | ||
private Kind kind; | ||
|
||
protected Invite() { | ||
} | ||
|
||
public Invite(User inviter, User invitee, Kind kind) { | ||
this(inviter, invitee, kind, Status.WAIT); | ||
} | ||
|
||
private Invite(User inviter, User invitee, Kind kind, Status status) { | ||
Preconditions.checkArgument(inviter != null, "inviter must be provided"); | ||
Preconditions.checkArgument(invitee != null, "invitee must be provided"); | ||
Preconditions.checkArgument(kind != null, "kind must be provided"); | ||
Preconditions.checkArgument(status != null, "status must be provided"); | ||
|
||
this.inviter = inviter; | ||
this.invitee = invitee; | ||
this.kind = kind; | ||
this.status = status; | ||
} | ||
|
||
public void update(Status status) { | ||
this.status = ObjectUtils.defaultIfNull(status, this.status); | ||
} | ||
} |
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.sequence.anonymous.invite.domain; | ||
|
||
public enum Kind { | ||
MATCH_POST, FRIEND | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/java/com/sequence/anonymous/invite/domain/Status.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,5 @@ | ||
package com.sequence.anonymous.invite.domain; | ||
|
||
public enum Status { | ||
WAIT, DONE | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/com/sequence/anonymous/invite/presentation/dto/UpdateDto.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,13 @@ | ||
package com.sequence.anonymous.invite.presentation.dto; | ||
|
||
import com.sequence.anonymous.invite.domain.Status; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public class UpdateDto { | ||
|
||
private Status status; | ||
|
||
protected UpdateDto() { | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
src/main/java/com/sequence/anonymous/matchPost/domain/MatchPost.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,67 @@ | ||
package com.sequence.anonymous.matchpost.domain; | ||
|
||
import com.google.common.base.Preconditions; | ||
import com.sequence.anonymous.common.BaseTimeEntity; | ||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.EnumType; | ||
import jakarta.persistence.Enumerated; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import lombok.Getter; | ||
import org.apache.commons.lang3.ObjectUtils; | ||
|
||
@Entity | ||
@Getter | ||
public class MatchPost extends BaseTimeEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(length = 40, nullable = false) | ||
private String title; | ||
|
||
@Column(columnDefinition = "TEXT", nullable = false) | ||
private String introduce; | ||
|
||
@Column(length = 50) | ||
private String appeal; | ||
|
||
@Column(length = 10) | ||
@Enumerated(EnumType.STRING) | ||
private Status status; | ||
|
||
protected MatchPost() { | ||
} | ||
|
||
public MatchPost(String title, String introduce) { | ||
this(title, introduce, "No Data"); | ||
} | ||
|
||
public MatchPost(String title, String introduce, String appeal) { | ||
this(null, title, introduce, appeal, Status.RECRUIT); | ||
} | ||
|
||
protected MatchPost(Long id, String title, String introduce, String appeal, | ||
Status status) { | ||
Preconditions.checkArgument(title != null, "title must be provided"); | ||
Preconditions.checkArgument(introduce != null, "introduce must be provided"); | ||
ckyeon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Preconditions.checkArgument(appeal != null, "appeal must be provided"); | ||
Preconditions.checkArgument(status != null, "status must be provided"); | ||
|
||
this.id = id; | ||
this.title = title; | ||
this.introduce = introduce; | ||
this.appeal = appeal; | ||
this.status = status; | ||
} | ||
|
||
public void update(String title, String introduce, String appeal, Status status) { | ||
this.title = ObjectUtils.defaultIfNull(title, this.title); | ||
this.introduce = ObjectUtils.defaultIfNull(introduce, this.introduce); | ||
this.appeal = ObjectUtils.defaultIfNull(appeal, this.appeal); | ||
this.status = ObjectUtils.defaultIfNull(status, this.status); | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/java/com/sequence/anonymous/matchPost/domain/Status.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,5 @@ | ||
package com.sequence.anonymous.matchpost.domain; | ||
|
||
public enum Status { | ||
RECRUIT, DONE | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/com/sequence/anonymous/matchPost/presentation/dto/UpdateDto.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,19 @@ | ||
package com.sequence.anonymous.matchpost.presentation.dto; | ||
|
||
import com.sequence.anonymous.matchpost.domain.Status; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public class UpdateDto { | ||
|
||
private String title; | ||
|
||
private String introduce; | ||
|
||
private String appeal; | ||
|
||
private Status status; | ||
|
||
protected UpdateDto() { | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Point
와 같은Value Object
를 사용하시려면 사용하는 엔티티 프로퍼티에@Embedded
를 달아주시고,Point
클래스에@Embeddable
을 달아주셔야 합니다.