-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
6 changed files
with
104 additions
and
27 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
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
30 changes: 30 additions & 0 deletions
30
noti-service/src/main/java/com/waither/notiservice/service/NotificaitonRecordService.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,30 @@ | ||
package com.waither.notiservice.service; | ||
|
||
import com.waither.notiservice.domain.redis.NotificationRecord; | ||
import com.waither.notiservice.global.exception.CustomException; | ||
import com.waither.notiservice.repository.redis.NotificationRecordRepository; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.Optional; | ||
|
||
@RequiredArgsConstructor | ||
@Service | ||
public class NotificaitonRecordService { | ||
|
||
private final NotificationRecordRepository notificationRecordRepository; | ||
|
||
public void updateWindAlarm(String email) { | ||
Optional<NotificationRecord> notificationRecord = notificationRecordRepository.findByEmail(email); | ||
|
||
notificationRecord.ifPresentOrElse(record -> record.setLastWindAlarmReceived(LocalDateTime.now()), null); | ||
} | ||
|
||
public void updateRainAlarm(String email) { | ||
Optional<NotificationRecord> notificationRecord = notificationRecordRepository.findByEmail(email); | ||
notificationRecord.ifPresent(record -> record.setLastRainAlarmReceived(LocalDateTime.now())); | ||
} | ||
|
||
|
||
} |
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