-
Notifications
You must be signed in to change notification settings - Fork 1
Dev 브랜치 코드 Main 병합 #32
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
Changes from all commits
04382b9
c089b80
c9b6b47
699da94
4d9528d
3f484e6
4e32c83
46b58bc
578057b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| package hs.kr.backend.devpals.domain.user.dto; | ||
|
|
||
| import hs.kr.backend.devpals.domain.user.entity.alarm.CommentAlarmEntity; | ||
| import lombok.AllArgsConstructor; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| @Getter | ||
| @NoArgsConstructor | ||
| @AllArgsConstructor | ||
| public class CommentAlarmDto extends AlarmDto{ | ||
|
|
||
| private Boolean replier; | ||
| private Long reCommentUserId; | ||
|
|
||
| public CommentAlarmDto(CommentAlarmEntity entity) { | ||
| super(entity.getId(), entity.getRoutingId(), entity.getContent(), entity.isEnabled(), entity.getAlarmFilterIntValue(), entity.getCreatedAt()); | ||
| this.replier = entity.getReplier(); | ||
| this.reCommentUserId = getReCommentUserIdIfNotNull(entity); | ||
| } | ||
|
|
||
| //대댓글이 존재하면 유저id 반환 없으면 0 반환 | ||
| private Long getReCommentUserIdIfNotNull(CommentAlarmEntity entity) { | ||
| if(entity.getRecomment() != null && entity.getRecomment().getUser() != null) return entity.getRecomment().getUser().getId(); | ||
| else return 0L; | ||
| } | ||
| } |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| package hs.kr.backend.devpals.domain.user.entity.alarm; | ||
|
|
||
| import hs.kr.backend.devpals.domain.project.entity.ApplicantEntity; | ||
| import hs.kr.backend.devpals.domain.project.entity.CommentEntity; | ||
| import hs.kr.backend.devpals.domain.project.entity.ProjectEntity; | ||
| import hs.kr.backend.devpals.domain.user.entity.UserEntity; | ||
| import hs.kr.backend.devpals.global.common.enums.AlarmFilter; | ||
| import jakarta.persistence.*; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| import java.time.LocalDateTime; | ||
|
|
||
| @Entity | ||
| @Getter | ||
| @NoArgsConstructor | ||
| @Inheritance(strategy = InheritanceType.JOINED) | ||
| @DiscriminatorColumn(name = "ALARM_FILTER", | ||
| discriminatorType = DiscriminatorType.STRING) | ||
|
|
||
| @Table(name = "Alarm") | ||
| public abstract class AlarmEntity { | ||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| private Long id; | ||
|
|
||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "receiver_id", nullable = false) | ||
| private UserEntity receiver; | ||
|
|
||
|
|
||
| @Column(length = 255) | ||
| private String content; | ||
|
|
||
| @Column(nullable = false, columnDefinition = "BOOLEAN DEFAULT FALSE") | ||
| private boolean enabled = false; | ||
|
|
||
| @Column | ||
| private Long routingId; //AlarmFilter마다 | ||
|
|
||
|
|
||
| // @Enumerated(EnumType.STRING) | ||
| // private AlarmFilter alarmFilter; | ||
|
|
||
| @Column(updatable = false) | ||
| private LocalDateTime createdAt = LocalDateTime.now(); | ||
|
|
||
| public AlarmEntity(UserEntity receiver, String content, Long routingId) { | ||
| this.receiver = receiver; | ||
| this.content = content; | ||
| this.routingId = routingId; | ||
| } | ||
|
|
||
| public abstract Integer getAlarmFilterIntValue(); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| package hs.kr.backend.devpals.domain.user.entity.alarm; | ||
|
|
||
| import hs.kr.backend.devpals.domain.project.entity.ApplicantEntity; | ||
| import hs.kr.backend.devpals.domain.project.entity.ProjectEntity; | ||
| import jakarta.persistence.*; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| import static hs.kr.backend.devpals.domain.user.entity.alarm.constants.AlarmFilterConstants.APPLIED_PROJECTS; | ||
| import static hs.kr.backend.devpals.domain.user.entity.alarm.constants.AlarmFilterConstants.APPLIED_PROJECT_INT_VALUE; | ||
|
|
||
| @Entity | ||
| @DiscriminatorValue(APPLIED_PROJECTS) | ||
| @NoArgsConstructor | ||
| @Table(name = "ApplicantAlarm") // 테이블 이름 지정 | ||
| public class ApplicantAlarmEntity extends AlarmEntity { | ||
| //"지원한 프로젝트" 알람 (지원 결과) | ||
| //공고 지원자가 지원한 프로젝트에 합격, 불합격 여부를 전달하는 알람 | ||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "project_id", nullable = false) | ||
| private ProjectEntity project; | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "applicant_id", nullable = false) | ||
| private ApplicantEntity applicant; | ||
|
|
||
| public ApplicantAlarmEntity(ApplicantEntity applicantEntity, String content, ProjectEntity project) { | ||
| super(applicantEntity.getUser(),content,project.getId()); | ||
| this.project = project; | ||
| this.applicant = applicantEntity; | ||
|
|
||
| } | ||
|
|
||
| public Integer getAlarmFilterIntValue() { | ||
| return APPLIED_PROJECT_INT_VALUE; | ||
| } | ||
|
Comment on lines
+33
to
+35
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. 💡 Verification agent 🧩 Analysis chain필터 값 중복 확인 필요
🏁 Script executed: #!/bin/bash
# 필터 상수 파일의 내용을 확인합니다.
cat src/main/java/hs/kr/backend/devpals/domain/user/entity/alarm/constants/AlarmFilterConstants.javaLength of output: 597 다른 AlarmEntity 클래스들의 🏁 Script executed: #!/bin/bash
# 각 AlarmEntity 클래스의 getAlarmFilterIntValue 반환 값을 조사합니다.
rg -n "getAlarmFilterIntValue" -A2 src/main/java/hs/kr/backend/devpals/domain/user/entity/alarmLength of output: 1404 AlarmFilterConstants의 필터 값에 고유한 정수 할당 필요 현재 모든 필터 상수( 조치 사항:
엔티티 클래스의 |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| package hs.kr.backend.devpals.domain.user.entity.alarm; | ||
|
|
||
| import hs.kr.backend.devpals.domain.project.entity.CommentEntity; | ||
| import hs.kr.backend.devpals.domain.project.entity.ProjectEntity; | ||
| import hs.kr.backend.devpals.domain.project.entity.RecommentEntity; | ||
| import hs.kr.backend.devpals.domain.user.entity.UserEntity; | ||
| import jakarta.persistence.*; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| import static hs.kr.backend.devpals.domain.user.entity.alarm.constants.AlarmFilterConstants.*; | ||
|
|
||
| @Entity | ||
| @DiscriminatorValue(COMMENT_AND_REPLY) | ||
| @NoArgsConstructor | ||
| @Getter | ||
| @Table(name = "CommentAlarm") // 테이블 이름 지정 | ||
| public class CommentAlarmEntity extends AlarmEntity { | ||
| // 댓글 알람 -> 공고에 댓글을 달았을 시, 댓글에 답변을 달았을 시 전달되는 알람 | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "project_id", nullable = false) | ||
| private ProjectEntity project; | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "comment_id", nullable = false) | ||
| private CommentEntity comment; | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "recomment_id") | ||
| private RecommentEntity recomment; | ||
|
|
||
| @Column | ||
| private Boolean replier; | ||
|
|
||
| //공고에 댓글 달았을 시 공고 게시자에게 알람 전송 | ||
| public CommentAlarmEntity(CommentEntity comment, String content, ProjectEntity project, UserEntity projectAuthor) { | ||
| super(projectAuthor,content,project.getId()); | ||
| this.comment = comment; | ||
| this.project = project; | ||
| this.replier = false; | ||
| } | ||
|
|
||
| public CommentAlarmEntity(CommentEntity comment, String content, ProjectEntity project, RecommentEntity recomment,UserEntity receiver) { | ||
| super(receiver,content,project.getId()); | ||
| this.comment = comment; | ||
| this.project = project; | ||
| this.recomment = recomment; | ||
| this.replier = true; | ||
| } | ||
|
|
||
| public Integer getAlarmFilterIntValue() { | ||
| return COMMENT_AND_REPLY_INT_VALUE; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| package hs.kr.backend.devpals.domain.user.entity.alarm; | ||
|
|
||
| import hs.kr.backend.devpals.domain.project.entity.ApplicantEntity; | ||
| import hs.kr.backend.devpals.domain.project.entity.ProjectEntity; | ||
| import hs.kr.backend.devpals.domain.user.entity.UserEntity; | ||
| import jakarta.persistence.*; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| import static hs.kr.backend.devpals.domain.user.entity.alarm.constants.AlarmFilterConstants.*; | ||
|
|
||
| @Entity | ||
| @DiscriminatorValue(APPLICANT_CHECK) | ||
| @NoArgsConstructor | ||
| @Table(name = "ProjectAlarm") // 테이블 이름 지정 | ||
| public class ProjectAlarmEntity extends AlarmEntity{ | ||
| //공고에 지원자가 지원할 시 공고생성자가 수신받는 알림 | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "project_id", nullable = false) | ||
| private ProjectEntity project; | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "applicant_id", nullable = false) | ||
| private ApplicantEntity applicant; | ||
|
|
||
|
|
||
| public ProjectAlarmEntity(ProjectEntity project, UserEntity author, String content,ApplicantEntity applicant) { | ||
| super(author,content, project.getId()); | ||
| this.project = project; | ||
| this.applicant = applicant; | ||
| } | ||
|
|
||
| public Integer getAlarmFilterIntValue() { | ||
| return APPLICANT_CHECK_INT_VALUE; | ||
| } | ||
|
Comment on lines
+33
to
+35
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. 필터 값 중복 확인 필요
#!/bin/bash
# AlarmEntity의 자식 클래스들이 반환하는 필터 값을 확인합니다.
echo "ApplicantAlarmEntity returns:"
grep -n "return.*INT_VALUE" src/main/java/hs/kr/backend/devpals/domain/user/entity/alarm/ApplicantAlarmEntity.java
echo -e "\nProjectAlarmEntity returns:"
grep -n "return.*INT_VALUE" src/main/java/hs/kr/backend/devpals/domain/user/entity/alarm/ProjectAlarmEntity.java
echo -e "\nCommentAlarmEntity returns:"
grep -n "return.*INT_VALUE" src/main/java/hs/kr/backend/devpals/domain/user/entity/alarm/CommentAlarmEntity.java
echo -e "\nAlarmFilterConstants defines:"
grep -n "INT_VALUE" src/main/java/hs/kr/backend/devpals/domain/user/entity/alarm/constants/AlarmFilterConstants.java |
||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.