Skip to content

Commit

Permalink
[Fix] 댓글알림기능 버그 수정#141
Browse files Browse the repository at this point in the history
  • Loading branch information
parseyong committed Sep 8, 2024
1 parent 051b57f commit 9a74353
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import me.snaptime.alarm.common.AlarmType;
import me.snaptime.alarm.dto.res.AlarmFindAllResDto;
import me.snaptime.alarm.service.AlarmService;
Expand All @@ -24,6 +25,7 @@
@RequestMapping("/alarms")
@RequiredArgsConstructor
@Tag(name = "[Alarm] Alarm API")
@Log4j2
public class AlarmController {

private final AlarmService alarmService;
Expand Down Expand Up @@ -67,7 +69,7 @@ public ResponseEntity<CommonResponseDto<ParentReplyPagingResDto>> readReplyAlarm

return ResponseEntity.status(HttpStatus.OK)
.body(new CommonResponseDto("댓글알림 조회 성공",
alarmService.readSnapAlarm(userDetails.getUsername(), replyAlarmId)));
alarmService.readReplyAlarm(userDetails.getUsername(), replyAlarmId)));
}

@GetMapping("/count/not-read")
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/me/snaptime/alarm/domain/ReplyAlarm.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.hibernate.annotations.OnDeleteAction;

@Entity
@Table(name = "reply_alarm")
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class ReplyAlarm extends BaseTimeEntity {
Expand All @@ -24,11 +25,13 @@ public class ReplyAlarm extends BaseTimeEntity {

@ManyToOne
@OnDelete(action = OnDeleteAction.CASCADE)
@JoinColumn(name = "sender_id",nullable = false)
// 행위(댓글 등록)을 통해 receiver에게 알림을 보내는 유저
private User sender;

@ManyToOne
@OnDelete(action = OnDeleteAction.CASCADE)
@JoinColumn(name = "receiver_id",nullable = false)
// 알림을 받는 유저
private User receiver;

Expand Down

0 comments on commit 9a74353

Please sign in to comment.