-
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.
- Loading branch information
1 parent
5eb111d
commit 0fc17f4
Showing
5 changed files
with
112 additions
and
4 deletions.
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
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
43 changes: 43 additions & 0 deletions
43
...n/java/com/modernfarmer/farmusspring/domain/farmclub/entity/MissionPostCommentReport.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,43 @@ | ||
package com.modernfarmer.farmusspring.domain.farmclub.entity; | ||
|
||
import com.modernfarmer.farmusspring.domain.user.entity.User; | ||
import jakarta.persistence.*; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.experimental.SuperBuilder; | ||
import org.hibernate.annotations.OnDelete; | ||
import org.hibernate.annotations.OnDeleteAction; | ||
|
||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
@Getter | ||
@SuperBuilder | ||
@Entity(name = "mission_post_comment_report") | ||
public class MissionPostCommentReport { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "mission_post_comment_report_id") | ||
private Long id; | ||
|
||
@OnDelete(action = OnDeleteAction.CASCADE) | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "mission_post_comment_id") | ||
private MissionPostComment missionPostComment; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "user_id") | ||
private User user; | ||
|
||
public static MissionPostCommentReport createMissionPostCommentReport(MissionPostComment missionPostComment, User user){ | ||
MissionPostCommentReport report = MissionPostCommentReport.builder() | ||
.missionPostComment(missionPostComment) | ||
.user(user) | ||
.build(); | ||
|
||
missionPostComment.addReport(report); | ||
return report; | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
src/main/java/com/modernfarmer/farmusspring/domain/farmclub/entity/MissionPostReport.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,43 @@ | ||
package com.modernfarmer.farmusspring.domain.farmclub.entity; | ||
|
||
import com.modernfarmer.farmusspring.domain.user.entity.User; | ||
import jakarta.persistence.*; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.experimental.SuperBuilder; | ||
import org.hibernate.annotations.OnDelete; | ||
import org.hibernate.annotations.OnDeleteAction; | ||
|
||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
@Getter | ||
@SuperBuilder | ||
@Entity(name = "mission_post_report") | ||
public class MissionPostReport { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "mission_post_report_id") | ||
private Long id; | ||
|
||
@OnDelete(action = OnDeleteAction.CASCADE) | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "mission_post_id") | ||
private MissionPost missionPost; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "user_id") | ||
private User user; | ||
|
||
public static MissionPostReport createMissionPostReport(MissionPost missionPost, User user){ | ||
MissionPostReport report = MissionPostReport.builder() | ||
.missionPost(missionPost) | ||
.user(user) | ||
.build(); | ||
|
||
missionPost.addReport(report); | ||
return report; | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
...om/modernfarmer/farmusspring/domain/farmclub/repository/MissionPostCommentRepository.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,7 @@ | ||
package com.modernfarmer.farmusspring.domain.farmclub.repository; | ||
|
||
import com.modernfarmer.farmusspring.domain.farmclub.entity.MissionPostComment; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface MissionPostCommentRepository extends JpaRepository<MissionPostComment, Long> { | ||
} |