-
Notifications
You must be signed in to change notification settings - Fork 0
feat: entity 클래스 추가 #10
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
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
c7e9aa0
Merge pull request #1 from Runners-Fight/develop
choiseoji 6ec015e
[#9] feat: 필요없는 enum 삭제
choiseoji 2d3b7ef
[#9] feat: JpaAuditing 설정 어노테이션 추가
choiseoji 9dd33bd
[#9] feat: baseEntity 추가
choiseoji 79d19e8
[#9] fix: 오타 삭제
choiseoji 42117fc
[#9] feat: crew entity 정의
choiseoji fb3546f
[#9] feat: crewRecord entity 정R
choiseoji d5b99b6
[#9] feat: event entity 정R
choiseoji 5313ea9
[#9] feat: joinCrew entity 정R
choiseoji 462cb4d
[#9] feat: joinEvent entity 정R
choiseoji 2684c67
[#9] feat: 필요한 enums 추가
choiseoji 0a46b7a
[#9] feat: notification entity 추가
choiseoji 21ef061
[#9] feat: periodicEvent entity 추가
choiseoji db5da08
Merge branch 'main' into feat/9-entity
choiseoji 00047e5
Merge branch 'develop' into feat/9-entity
choiseoji a5c3aa4
[#9] fix: Member 생성자에서 role 주입하는거 삭제
choiseoji 6d56818
[#9] feat: crews 테이블명 추가
choiseoji ed05eaa
[#9] feat: 테이블명 추가
choiseoji 5f952c4
[#9] fix: Role 세부적으로 분리
choiseoji 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,59 @@ | ||
| package run.backend.domain.crew.entity; | ||
|
|
||
| import jakarta.persistence.*; | ||
| import lombok.AccessLevel; | ||
| import lombok.Builder; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
| import run.backend.global.common.BaseEntity; | ||
|
|
||
| import java.math.BigDecimal; | ||
| import java.util.UUID; | ||
|
|
||
| @Entity | ||
| @Getter | ||
| @Table(name = "crews") | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| public class Crew extends BaseEntity { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| private Long id; | ||
|
|
||
| private String name; | ||
|
|
||
| private String description; | ||
|
|
||
| private String image; | ||
|
|
||
| @Column(name = "invite_code") | ||
| private String inviteCode; | ||
|
|
||
| @Column(name = "member_count") | ||
| private Long memberCount; | ||
|
|
||
| @Column(name = "monthly_distance_total") | ||
| private BigDecimal monthlyDistanceTotal; | ||
|
|
||
| @Column(name = "monthly_time_total") | ||
| private Long monthlyTimeTotal; | ||
|
|
||
| @Column(name = "monthly_score_total") | ||
| private BigDecimal monthlyScoreTotal; | ||
|
|
||
| @Builder | ||
| public Crew ( | ||
| String name, | ||
| String description, | ||
| String image | ||
| ) { | ||
| this.name = name; | ||
| this.description = description; | ||
| this.image = image; | ||
| this.inviteCode = UUID.randomUUID().toString(); | ||
| this.memberCount = 1L; | ||
| this.monthlyDistanceTotal = BigDecimal.ZERO; | ||
| this.monthlyTimeTotal = 0L; | ||
| this.monthlyScoreTotal = BigDecimal.ZERO; | ||
| } | ||
| } |
60 changes: 60 additions & 0 deletions
60
src/main/java/run/backend/domain/crew/entity/JoinCrew.java
This file contains hidden or 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,60 @@ | ||
| package run.backend.domain.crew.entity; | ||
|
|
||
| import jakarta.persistence.*; | ||
| import lombok.AccessLevel; | ||
| import lombok.Builder; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
| import run.backend.domain.crew.enums.JoinStatus; | ||
| import run.backend.domain.member.entity.Member; | ||
| import run.backend.domain.member.enums.Role; | ||
| import run.backend.global.common.BaseEntity; | ||
|
|
||
| import java.time.LocalDate; | ||
|
|
||
|
|
||
| @Entity | ||
| @Getter | ||
| @Table(name = "join_crews") | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| public class JoinCrew extends BaseEntity { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| private Long id; | ||
|
|
||
| @Enumerated(EnumType.STRING) | ||
| @Column(name = "join_status") | ||
| private JoinStatus joinStatus; | ||
|
|
||
| @Enumerated(EnumType.STRING) | ||
| @Column(name = "crew_role") | ||
| private Role role; | ||
|
|
||
| @Column(name = "joined_date") | ||
| private LocalDate joinedDate; | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "member_id") | ||
| private Member member; | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "crew_id") | ||
| private Crew crew; | ||
|
|
||
| void approveJoin() { | ||
| this.role = Role.MEMBER; | ||
| this.joinedDate = LocalDate.now(); | ||
| this.joinStatus = JoinStatus.APPROVED; | ||
| } | ||
|
|
||
| @Builder | ||
| public JoinCrew( | ||
| Member member, | ||
| Crew crew | ||
| ) { | ||
| this.crew = crew; | ||
| this.member = member; | ||
| this.joinStatus = JoinStatus.APPLIED; | ||
| } | ||
| } |
4 changes: 0 additions & 4 deletions
4
src/main/java/run/backend/domain/crew/enumerate/CrewMemberRole.java
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
src/main/java/run/backend/domain/crew/enums/JoinStatus.java
This file contains hidden or 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,16 @@ | ||
| package run.backend.domain.crew.enums; | ||
|
|
||
| import lombok.Getter; | ||
|
|
||
| @Getter | ||
| public enum JoinStatus { | ||
|
|
||
| APPLIED("가입 요청"), | ||
| APPROVED("가입 승인"); | ||
|
|
||
| private final String description; | ||
|
|
||
| JoinStatus(String description) { | ||
| this.description = description; | ||
| } | ||
| } |
This file contains hidden or 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
This file contains hidden or 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,79 @@ | ||
| package run.backend.domain.event.entity; | ||
|
|
||
| import jakarta.persistence.*; | ||
| import lombok.AccessLevel; | ||
| import lombok.Builder; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
| import run.backend.domain.crew.entity.Crew; | ||
| import run.backend.domain.member.entity.Member; | ||
| import run.backend.domain.record.entity.CrewRecord; | ||
| import run.backend.global.common.BaseEntity; | ||
|
|
||
| import java.time.LocalDate; | ||
| import java.time.LocalTime; | ||
|
|
||
|
|
||
| @Entity | ||
| @Getter | ||
| @Table(name = "events") | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| public class Event extends BaseEntity { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| private Long id; | ||
|
|
||
| private String title; | ||
|
|
||
| private LocalDate date; | ||
|
|
||
| @Column(name = "start_time") | ||
| private LocalTime startTime; | ||
|
|
||
| @Column(name = "end_time") | ||
| private LocalTime endTime; | ||
|
|
||
| private String place; | ||
|
|
||
| @Column(name = "expected_participants") | ||
| private Long expectedParticipants; | ||
|
|
||
| @Column(name = "actual_participants") | ||
| private Long actualParticipants; | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "crew_id") | ||
| private Crew crew; | ||
|
|
||
| @OneToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "record_id") | ||
| private CrewRecord record; | ||
|
|
||
| @OneToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "running_captain") | ||
| private Member member; | ||
|
|
||
| @Builder | ||
| public Event( | ||
| String title, | ||
| LocalDate date, | ||
| LocalTime startTime, | ||
| LocalTime endTime, | ||
| String place, | ||
| Crew crew, | ||
| CrewRecord record, | ||
| Member member | ||
| ) { | ||
| this.title = title; | ||
| this.date = date; | ||
| this.startTime = startTime; | ||
| this.endTime = endTime; | ||
| this.place = place; | ||
| this.expectedParticipants = 1L; | ||
| this.actualParticipants = 0L; | ||
| this.crew = crew; | ||
| this.record = record; | ||
| this.member = member; | ||
| } | ||
| } |
40 changes: 40 additions & 0 deletions
40
src/main/java/run/backend/domain/event/entity/JoinEvent.java
This file contains hidden or 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 run.backend.domain.event.entity; | ||
|
|
||
| import jakarta.persistence.*; | ||
| import lombok.AccessLevel; | ||
| import lombok.Builder; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
| import run.backend.domain.member.entity.Member; | ||
|
|
||
| @Entity | ||
| @Getter | ||
| @Table(name = "join_events") | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| public class JoinEvent { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| private Long id; | ||
|
|
||
| @Column(name = "is_running") | ||
| private boolean isRunning; | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "member_id") | ||
| private Member member; | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "event_id") | ||
| private Event event; | ||
|
|
||
| @Builder | ||
| public JoinEvent( | ||
| Member member, | ||
| Event event | ||
| ) { | ||
| this.isRunning = false; | ||
| this.member = member; | ||
| this.event = event; | ||
| } | ||
| } |
71 changes: 71 additions & 0 deletions
71
src/main/java/run/backend/domain/event/entity/PeriodicEvent.java
This file contains hidden or 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,71 @@ | ||
| package run.backend.domain.event.entity; | ||
|
|
||
| import jakarta.persistence.*; | ||
| import lombok.AccessLevel; | ||
| import lombok.Builder; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
| import run.backend.domain.crew.entity.Crew; | ||
| import run.backend.domain.event.enums.RepeatCycle; | ||
| import run.backend.domain.event.enums.WeekDay; | ||
| import run.backend.global.common.BaseEntity; | ||
|
|
||
| import java.time.LocalDate; | ||
| import java.time.LocalTime; | ||
|
|
||
| @Entity | ||
| @Getter | ||
| @Table(name = "periodic_events") | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| public class PeriodicEvent extends BaseEntity { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| private Long id; | ||
|
|
||
| private String title; | ||
|
|
||
| @Column(name = "base_date") | ||
| private LocalDate baseDate; | ||
|
|
||
| @Enumerated(EnumType.STRING) | ||
| @Column(name = "repeat_cycle") | ||
| private RepeatCycle repeatCycle; | ||
|
|
||
| @Enumerated(EnumType.STRING) | ||
| @Column(name = "repeat_days") | ||
| private WeekDay repeatDays; | ||
|
|
||
| @Column(name = "start_time") | ||
| private LocalTime startTime; | ||
|
|
||
| @Column(name = "end_time") | ||
| private LocalTime endTime; | ||
|
|
||
| private String place; | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "crew_id") | ||
| private Crew crew; | ||
|
|
||
| @Builder | ||
| public PeriodicEvent( | ||
| String title, | ||
| LocalDate baseDate, | ||
| RepeatCycle repeatCycle, | ||
| WeekDay repeatDays, | ||
| LocalTime startTime, | ||
| LocalTime endTime, | ||
| String place, | ||
| Crew crew | ||
| ) { | ||
| this.title = title; | ||
| this.baseDate = baseDate; | ||
| this.repeatCycle = repeatCycle; | ||
| this.repeatDays = repeatDays; | ||
| this.startTime = startTime; | ||
| this.endTime = endTime; | ||
| this.place = place; | ||
| this.crew = crew; | ||
| } | ||
| } |
16 changes: 16 additions & 0 deletions
16
src/main/java/run/backend/domain/event/enums/RepeatCycle.java
This file contains hidden or 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,16 @@ | ||
| package run.backend.domain.event.enums; | ||
|
|
||
| import lombok.Getter; | ||
|
|
||
| @Getter | ||
| public enum RepeatCycle { | ||
|
|
||
| NONE("주기 없음"), | ||
| WEEKLY("1주 마다"); | ||
|
|
||
| private final String description; | ||
|
|
||
| RepeatCycle(String description) { | ||
| this.description = description; | ||
| } | ||
| } |
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.
오 이거 좋다~