-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from Team-Going/feature/6
[feat] 엔티티 클래스 매핑
- Loading branch information
Showing
9 changed files
with
194 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
doorip-domain/src/main/java/org/doorip/todo/domain/Allocator.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,24 @@ | ||
package org.doorip.todo.domain; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.*; | ||
import org.doorip.common.BaseTimeEntity; | ||
import org.doorip.trip.domain.Participant; | ||
|
||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
@Builder(access = AccessLevel.PRIVATE) | ||
@Getter | ||
@Entity | ||
public class Allocator extends BaseTimeEntity { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "allocator_id") | ||
private Long id; | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "participant_id") | ||
private Todo todo; | ||
@OneToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "todo_id") | ||
private Participant participant; | ||
} |
5 changes: 5 additions & 0 deletions
5
doorip-domain/src/main/java/org/doorip/todo/domain/Progress.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 org.doorip.todo.domain; | ||
|
||
public enum Progress { | ||
INCOMPLETE, COMPLETE | ||
} |
5 changes: 5 additions & 0 deletions
5
doorip-domain/src/main/java/org/doorip/todo/domain/Secret.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 org.doorip.todo.domain; | ||
|
||
public enum Secret { | ||
OUR, MY | ||
} |
38 changes: 38 additions & 0 deletions
38
doorip-domain/src/main/java/org/doorip/todo/domain/Todo.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,38 @@ | ||
package org.doorip.todo.domain; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.*; | ||
import org.doorip.common.BaseTimeEntity; | ||
import org.doorip.trip.domain.Trip; | ||
|
||
import java.time.LocalDate; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
@Builder(access = AccessLevel.PRIVATE) | ||
@Getter | ||
@Entity | ||
public class Todo extends BaseTimeEntity { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "todo_id") | ||
private Long id; | ||
@Column(nullable = false) | ||
private String title; | ||
private LocalDate endDate; | ||
private String memo; | ||
@Column(nullable = false) | ||
@Enumerated(EnumType.STRING) | ||
private Secret secret; | ||
@Column(nullable = false) | ||
@Enumerated(EnumType.STRING) | ||
private Progress progress; | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "trip_id") | ||
private Trip trip; | ||
@Builder.Default | ||
@OneToMany(mappedBy = "todo", cascade = CascadeType.REMOVE) | ||
private List<Allocator> allocators = new ArrayList<>(); | ||
} |
40 changes: 40 additions & 0 deletions
40
doorip-domain/src/main/java/org/doorip/trip/domain/Participant.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,40 @@ | ||
package org.doorip.trip.domain; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.*; | ||
import org.doorip.common.BaseTimeEntity; | ||
import org.doorip.todo.domain.Allocator; | ||
import org.doorip.user.domain.User; | ||
|
||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
@Builder(access = AccessLevel.PRIVATE) | ||
@Getter | ||
@Entity | ||
public class Participant extends BaseTimeEntity { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "participant_id") | ||
private Long id; | ||
@Column(nullable = false) | ||
@Enumerated(EnumType.STRING) | ||
private Role role; | ||
@Column(nullable = false) | ||
private Integer styleA; | ||
@Column(nullable = false) | ||
private Integer styleB; | ||
@Column(nullable = false) | ||
private Integer styleC; | ||
@Column(nullable = false) | ||
private Integer styleD; | ||
@Column(nullable = false) | ||
private Integer styleE; | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "user_id") | ||
private User user; | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "trip_id") | ||
private Trip trip; | ||
@OneToOne(mappedBy = "participant", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE) | ||
private Allocator allocator; | ||
} |
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 org.doorip.trip.domain; | ||
|
||
public enum Role { | ||
HOST, PARTICIPATION | ||
} |
36 changes: 36 additions & 0 deletions
36
doorip-domain/src/main/java/org/doorip/trip/domain/Trip.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,36 @@ | ||
package org.doorip.trip.domain; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.*; | ||
import org.doorip.common.BaseTimeEntity; | ||
import org.doorip.todo.domain.Todo; | ||
|
||
import java.time.LocalDate; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
@Builder(access = AccessLevel.PRIVATE) | ||
@Getter | ||
@Entity | ||
public class Trip extends BaseTimeEntity { | ||
@Id | ||
@GeneratedValue | ||
@Column(name = "trip_id") | ||
private Long id; | ||
@Column(nullable = false) | ||
private String title; | ||
@Column(nullable = false) | ||
private LocalDate startDate; | ||
@Column(nullable = false) | ||
private LocalDate endDate; | ||
@Column(nullable = false) | ||
private String code; | ||
@Builder.Default | ||
@OneToMany(mappedBy = "trip", cascade = CascadeType.REMOVE) | ||
private List<Participant> participants = new ArrayList<>(); | ||
@Builder.Default | ||
@OneToMany(mappedBy = "trip", cascade = CascadeType.REMOVE) | ||
private List<Todo> todos = new ArrayList<>(); | ||
} |
5 changes: 5 additions & 0 deletions
5
doorip-domain/src/main/java/org/doorip/user/domain/Platform.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 org.doorip.user.domain; | ||
|
||
public enum Platform { | ||
KAKAO, APPLE | ||
} |
36 changes: 36 additions & 0 deletions
36
doorip-domain/src/main/java/org/doorip/user/domain/User.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,36 @@ | ||
package org.doorip.user.domain; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.*; | ||
import org.doorip.common.BaseTimeEntity; | ||
import org.doorip.trip.domain.Participant; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
@Builder(access = AccessLevel.PRIVATE) | ||
@Getter | ||
@Table(name = "users") | ||
@Entity | ||
public class User extends BaseTimeEntity { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "user_id") | ||
private Long id; | ||
@Column(nullable = false) | ||
private String name; | ||
@Column(nullable = false) | ||
private String intro; | ||
private Integer result; | ||
@Column(nullable = false) | ||
private String platformId; | ||
@Column(nullable = false) | ||
@Enumerated(EnumType.STRING) | ||
private Platform platform; | ||
private String refreshToken; | ||
@Builder.Default | ||
@OneToMany(mappedBy = "user", cascade = CascadeType.REMOVE) | ||
private List<Participant> participants = new ArrayList<>(); | ||
} |