diff --git a/clody-app/src/main/java/com/clody/clodyapi/alarm/controller/AlarmControllerImpl.java b/clody-app/src/main/java/com/clody/clodyapi/alarm/controller/AlarmControllerImpl.java index e333099..aa0bbc9 100644 --- a/clody-app/src/main/java/com/clody/clodyapi/alarm/controller/AlarmControllerImpl.java +++ b/clody-app/src/main/java/com/clody/clodyapi/alarm/controller/AlarmControllerImpl.java @@ -28,7 +28,7 @@ public class AlarmControllerImpl implements AlarmSwagger{ public ResponseEntity> getUserAlarmInfo() { AlarmResponse response = retrieveAlarmInfoUsecase.retrieveAlarmInfo(); return ResponseEntity.status(HttpStatus.OK).body( - ApiResponse.success(SuccessType.OK_SUCCESS, retrieveAlarmInfoUsecase.retrieveAlarmInfo()) + ApiResponse.success(SuccessType.OK_SUCCESS, response) ); } diff --git a/clody-app/src/main/java/com/clody/clodyapi/alarm/dto/response/AlarmFullResponse.java b/clody-app/src/main/java/com/clody/clodyapi/alarm/dto/response/AlarmFullResponse.java index 0ad53fd..21d7d67 100644 --- a/clody-app/src/main/java/com/clody/clodyapi/alarm/dto/response/AlarmFullResponse.java +++ b/clody-app/src/main/java/com/clody/clodyapi/alarm/dto/response/AlarmFullResponse.java @@ -2,22 +2,28 @@ import com.clody.domain.alarm.dto.AlarmTotalInfo; import java.time.LocalTime; +import java.time.format.DateTimeFormatter; public record AlarmFullResponse( boolean isDiaryAlarm, boolean isReplyAlarm, - LocalTime time, + String time, String fcmToken ) { - public static AlarmFullResponse of(boolean isDiaryAlarm, boolean isReplyAlarm, LocalTime time, String fcmToken) { - return new AlarmFullResponse(isDiaryAlarm, isReplyAlarm, time, fcmToken); - } - public static AlarmFullResponse parseFromAlarmInfo(AlarmTotalInfo alarmTotalInfo){ - return AlarmFullResponse.of(alarmTotalInfo.isDiaryAlarm(), alarmTotalInfo.isReplyAlarm(), alarmTotalInfo.alarmTime(), alarmTotalInfo.fcmToken()); - } + public static AlarmFullResponse of(boolean isDiaryAlarm, boolean isReplyAlarm, String time, + String fcmToken) { + return new AlarmFullResponse(isDiaryAlarm, isReplyAlarm, time, fcmToken); + } - public static AlarmTotalInfo toAlarmTotalInfo(AlarmFullResponse alarmFullResponse){ - return AlarmTotalInfo.of(alarmFullResponse.fcmToken(), alarmFullResponse.time(), alarmFullResponse.isDiaryAlarm(), alarmFullResponse.isReplyAlarm()); - } + public static AlarmFullResponse parseFromAlarmInfo(AlarmTotalInfo alarmTotalInfo) { + String timeWithoutSeconds = parseLocalTimeToString(alarmTotalInfo.alarmTime()); + return AlarmFullResponse.of(alarmTotalInfo.isDiaryAlarm(), alarmTotalInfo.isReplyAlarm(), + timeWithoutSeconds, alarmTotalInfo.fcmToken()); + } + + private static String parseLocalTimeToString(LocalTime time) { + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm"); + return time.format(formatter); + } } diff --git a/clody-app/src/main/java/com/clody/clodyapi/alarm/dto/response/AlarmResponse.java b/clody-app/src/main/java/com/clody/clodyapi/alarm/dto/response/AlarmResponse.java index 77a18ef..8656e0c 100644 --- a/clody-app/src/main/java/com/clody/clodyapi/alarm/dto/response/AlarmResponse.java +++ b/clody-app/src/main/java/com/clody/clodyapi/alarm/dto/response/AlarmResponse.java @@ -2,17 +2,24 @@ import com.clody.domain.alarm.dto.AlarmTotalInfo; import java.time.LocalTime; +import java.time.format.DateTimeFormatter; public record AlarmResponse( boolean isDiaryAlarm, boolean isReplyAlarm, - LocalTime time + String time ) { - public static AlarmResponse of(boolean isDiaryAlarm, boolean isReplyAlarm, LocalTime time) { + public static AlarmResponse of(boolean isDiaryAlarm, boolean isReplyAlarm, String time) { return new AlarmResponse(isDiaryAlarm, isReplyAlarm, time); } public static AlarmResponse of(AlarmTotalInfo alarmTotalInfo){ - return new AlarmResponse(alarmTotalInfo.isDiaryAlarm(), alarmTotalInfo.isReplyAlarm(), alarmTotalInfo.alarmTime()); + String timeWithoutSecond = parseLocalTimeToString(alarmTotalInfo.alarmTime()); + return new AlarmResponse(alarmTotalInfo.isDiaryAlarm(), alarmTotalInfo.isReplyAlarm(), timeWithoutSecond); + } + + private static String parseLocalTimeToString(LocalTime time) { + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm"); + return time.format(formatter); } } diff --git a/clody-app/src/main/java/com/clody/clodyapi/user/controller/dto/request/UserSignUpRequest.java b/clody-app/src/main/java/com/clody/clodyapi/user/controller/dto/request/UserSignUpRequest.java index c380e2f..9df9d7d 100644 --- a/clody-app/src/main/java/com/clody/clodyapi/user/controller/dto/request/UserSignUpRequest.java +++ b/clody-app/src/main/java/com/clody/clodyapi/user/controller/dto/request/UserSignUpRequest.java @@ -7,7 +7,6 @@ public record UserSignUpRequest( String platform, String email, String name, - String fcmToken ) { } diff --git a/clody-app/src/main/java/com/clody/clodyapi/user/controller/dto/response/UserInfoGetResponse.java b/clody-app/src/main/java/com/clody/clodyapi/user/controller/dto/response/UserInfoGetResponse.java index ea66d84..4a161c9 100644 --- a/clody-app/src/main/java/com/clody/clodyapi/user/controller/dto/response/UserInfoGetResponse.java +++ b/clody-app/src/main/java/com/clody/clodyapi/user/controller/dto/response/UserInfoGetResponse.java @@ -5,10 +5,10 @@ public record UserInfoGetResponse( String email, String name, - Platform platform + String platform ) { public static UserInfoGetResponse of(String email, String name, Platform platform){ - return new UserInfoGetResponse(email, name, platform); + return new UserInfoGetResponse(email, name, platform.getName()); } } diff --git a/clody-infra/src/main/java/com/clody/infra/models/diary/DiaryRepositoryAdapter.java b/clody-infra/src/main/java/com/clody/infra/models/diary/DiaryRepositoryAdapter.java index 478ae54..e78a1fa 100644 --- a/clody-infra/src/main/java/com/clody/infra/models/diary/DiaryRepositoryAdapter.java +++ b/clody-infra/src/main/java/com/clody/infra/models/diary/DiaryRepositoryAdapter.java @@ -4,7 +4,7 @@ import com.clody.domain.diary.repository.DiaryRepository; import com.clody.domain.user.User; import com.clody.support.dto.type.ErrorType; -import com.clody.support.exception.NotFoundException; +import com.clody.support.exception.BusinessException; import com.clody.support.security.util.JwtUtil; import java.time.LocalDateTime; import java.util.List; @@ -29,7 +29,7 @@ public List saveAll(List diaries) { public List findDiariesByUserIdAndCreatedAtBetween(Long userId, LocalDateTime start, LocalDateTime end) { return diaryRepository.findDiariesByUserIdAndCreatedAtBetween(userId, start, end) - .orElseThrow(() -> new NotFoundException(ErrorType.DIARY_MESSAGE_NOT_FOUND)); + .orElseThrow(() -> new BusinessException(ErrorType.DIARY_MESSAGE_NOT_FOUND)); } @Override