-
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.
[FEAT] add report domains and refactor schema
- Loading branch information
Showing
7 changed files
with
518 additions
and
122 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
src/main/java/com/gabojait/gabojaitspring/domain/report/Block.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,47 @@ | ||
package com.gabojait.gabojaitspring.domain.report; | ||
|
||
import com.gabojait.gabojaitspring.domain.base.BaseEntity; | ||
import com.gabojait.gabojaitspring.domain.user.User; | ||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import javax.persistence.*; | ||
import java.time.LocalDate; | ||
|
||
@Getter | ||
@Entity | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class Block extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "block_id") | ||
private Long id; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REMOVE) | ||
@JoinColumn(name = "user_id", nullable = false) | ||
private User user; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REMOVE) | ||
@JoinColumn(name = "blocker_id", nullable = false) | ||
private User blocker; | ||
|
||
@Column(nullable = false) | ||
private LocalDate startAt; | ||
|
||
@Column(nullable = false) | ||
private LocalDate endAt; | ||
|
||
@Builder | ||
private Block(LocalDate startAt, | ||
LocalDate endAt, | ||
User user, | ||
User blocker) { | ||
this.startAt = startAt; | ||
this.endAt = endAt; | ||
this.user = user; | ||
this.blocker = blocker; | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
src/main/java/com/gabojait/gabojaitspring/domain/report/Report.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,39 @@ | ||
package com.gabojait.gabojaitspring.domain.report; | ||
|
||
import com.gabojait.gabojaitspring.domain.base.BaseEntity; | ||
import com.gabojait.gabojaitspring.domain.user.User; | ||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import javax.persistence.*; | ||
|
||
@Getter | ||
@Entity | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class Report extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "report_id") | ||
private Long id; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REMOVE) | ||
@JoinColumn(name = "user_id", nullable = false) | ||
private User user; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REMOVE) | ||
@JoinColumn(name = "reporter_id", nullable = false) | ||
private User reporter; | ||
|
||
@Column(length = 100, nullable = false) | ||
private String reason; | ||
|
||
@Builder | ||
private Report(String reason, User user, User reporter) { | ||
this.reason = reason; | ||
this.user = user; | ||
this.reporter = reporter; | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
src/main/java/com/gabojait/gabojaitspring/domain/report/Suspend.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,58 @@ | ||
package com.gabojait.gabojaitspring.domain.report; | ||
|
||
import com.gabojait.gabojaitspring.domain.base.BaseEntity; | ||
import com.gabojait.gabojaitspring.domain.user.User; | ||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import javax.persistence.*; | ||
import java.time.LocalDate; | ||
|
||
@Getter | ||
@Entity | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class Suspend extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "suspend_id") | ||
private Long id; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REMOVE) | ||
@JoinColumn(name = "user_id", nullable = false) | ||
private User user; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REMOVE) | ||
@JoinColumn(name = "admin_id", nullable = false) | ||
private User admin; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REMOVE) | ||
@JoinColumn(name = "report_id") | ||
private Report report; | ||
|
||
@Column(length = 100) | ||
private String reason; | ||
|
||
@Column(nullable = false) | ||
private LocalDate startAt; | ||
|
||
@Column(nullable = false) | ||
private LocalDate endAt; | ||
|
||
@Builder | ||
private Suspend(String reason, | ||
LocalDate startAt, | ||
LocalDate endAt, | ||
User user, | ||
User admin, | ||
Report report) { | ||
this.reason = reason; | ||
this.startAt = startAt; | ||
this.endAt = endAt; | ||
this.user = user; | ||
this.admin = admin; | ||
this.report = report; | ||
} | ||
} |
Oops, something went wrong.