Skip to content

Commit 68d4713

Browse files
authored
[T3-119] 홈 루틴 조회 응답값 추가 (#30)
* fix: OneToOne에서 ManyToOne으로 변 * feat: 추천 루틴 조회 API * feat: swagger 추가 * feat: 루틴, 서브루틴 완료 ID 응답값 추가 * fix: 감정 구슬 1일 1회 선택여부 확인 validation 추가 * fix: onboarding 명세 수정 * feat: 추천 루틴 조회시 응답에 감정구슬 enum 값 추가 * fix: 명세 추가 * fix: 명세 수정 * remove: tokenResponse * feat: 루틴 조회 시 응답값 필드 추가
1 parent 5361695 commit 68d4713

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

src/main/java/bitnagil/bitnagil_backend/routine/response/RoutineSearchResponse.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package bitnagil.bitnagil_backend.routine.response;
22

3+
import bitnagil.bitnagil_backend.emotionMarble.domain.enums.EmotionMarbleType;
34
import io.swagger.v3.oas.annotations.media.Schema;
45
import lombok.AllArgsConstructor;
56
import lombok.Builder;
@@ -15,5 +16,9 @@
1516
@Builder
1617
public class RoutineSearchResponse {
1718
@Schema(description = "날짜(LocalDate: 2025-07-01)와 같은 형태를 key로 가지는 루틴 목록 Map입니다. Swagger에서는 additionalProp1처럼 보일 수 있습니다.")
18-
Map<LocalDate, List<RoutineSearchResultDto>> routines; // 날짜별 루틴 목록
19+
private Map<LocalDate, List<RoutineSearchResultDto>> routines; // 날짜별 루틴 목록
20+
@Schema(description = "회원명", example = "홍길동")
21+
private String nickname; // 회원명
22+
@Schema(description = "감정 구슬 타입", example = "CALM")
23+
private EmotionMarbleType emotionMarbleType; // 감정 구슬 타입
1924
}

src/main/java/bitnagil/bitnagil_backend/routine/service/RoutineService.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
import bitnagil.bitnagil_backend.changedRoutine.domain.enums.ChangedDivCode;
1515
import bitnagil.bitnagil_backend.changedRoutine.repository.ChangedRoutineRepository;
1616
import bitnagil.bitnagil_backend.changedRoutine.repository.ChangedSubRoutineRepository;
17+
import bitnagil.bitnagil_backend.emotionMarble.domain.EmotionMarble;
18+
import bitnagil.bitnagil_backend.emotionMarble.repository.EmotionMarbleRepository;
1719
import bitnagil.bitnagil_backend.routine.domain.RoutineCompletion;
1820
import bitnagil.bitnagil_backend.routine.domain.enums.RoutineType;
1921
import bitnagil.bitnagil_backend.routine.repository.RoutineCompletionRepository;
@@ -55,6 +57,7 @@ public class RoutineService {
5557
private final ChangedRoutineRepository changedRoutineRepository;
5658
private final ChangedSubRoutineRepository changedSubRoutineRepository;
5759
private final RoutineCompletionRepository routineCompletionRepository;
60+
private final EmotionMarbleRepository emotionMarbleRepository;
5861

5962
// 루틴, 세부루틴을 함께 저장하는 루틴 등록 메서드
6063
@Transactional
@@ -552,7 +555,14 @@ private RoutineSearchResponse queryRoutines(User user, LocalDate startDate, Loca
552555
routinesByDateResponse.get(key).sort((a, b)
553556
-> a.getExecutionTime().compareTo(b.getExecutionTime()));
554557
}
555-
return RoutineSearchResponse.builder().routines(routinesByDateResponse).build();
558+
559+
// 감정구슬 조회
560+
EmotionMarble emotionMarble = emotionMarbleRepository.findByUserIdAndDateIs(user.getUserPk().getId(), LocalDate.now());
561+
return RoutineSearchResponse.builder()
562+
.routines(routinesByDateResponse)
563+
.emotionMarbleType(emotionMarble == null ? null : emotionMarble.getEmotionMarbleType())
564+
.nickname(user.getNickname())
565+
.build();
556566
}
557567
}
558568

0 commit comments

Comments
 (0)