Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
… into dev
  • Loading branch information
dlwjddn123 committed Jul 22, 2024
2 parents 2169a5a + 03917e9 commit 7395ac8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
17 changes: 15 additions & 2 deletions src/main/java/nbdream/alarm/dto/AlarmHistoryListResDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
import nbdream.alarm.domain.AlarmHistory;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -36,14 +39,24 @@ public static AlarmHistoryListResDto from(List<AlarmHistory> alarmHistories) {

@Getter
@NoArgsConstructor
@AllArgsConstructor
class AlarmHistoryResDto {
private Long id;
private String alarmType;
private String title;
private String content;
private boolean checked;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "Asia/Seoul")
private LocalDateTime createdDate;

public AlarmHistoryResDto(Long id, String alarmType, String title, String content, boolean checked, LocalDateTime createdDate) {
this.id = id;
this.alarmType = alarmType;
this.title = title;
this.content = content;
this.checked = checked;
this.createdDate = ZonedDateTime.of(createdDate, ZoneId.of("UTC"))
.withZoneSameInstant(ZoneId.of("Asia/Seoul"))
.toLocalDateTime();
}

}
2 changes: 1 addition & 1 deletion src/main/java/nbdream/alarm/service/AlarmService.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ public void deleteFcmToken(Long memberId) {
public void sendCommentAlarm(Bulletin bulletin, String nickname) {
Alarm alarm = alarmRepository.findByMemberId(bulletin.getAuthor().getId());
isAlarmValid(alarm);
hasToken(alarm);
if(!alarm.isCommentAlarm()){
return;
}
hasToken(alarm);
try {
String body = "\"" + nickname + "\"" + "님이 게시글에 새 댓글을 달았습니다.";
FcmSendDto fcmSendDto = new FcmSendDto(alarm.getFcmToken(), "농부의 꿈", body, bulletin.getId(), AlarmType.COMMENT);
Expand Down

0 comments on commit 7395ac8

Please sign in to comment.