Skip to content

Commit cadbbb5

Browse files
committed
hotfix: 트레이니 홈 특정 날짜 기록 조회 API
- 트레이너 프로필 사진 추가 - config yml update
1 parent b99ee6b commit cadbbb5

File tree

5 files changed

+12
-6
lines changed

5 files changed

+12
-6
lines changed

src/main/java/com/tnt/application/pt/PtService.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,11 @@ public GetTraineeDailyRecordsResponse getDailyRecords(Long memberId, LocalDate d
274274

275275
// PT 정보 조회
276276
TraineeProjection.PtInfoDto ptResult = ptLessonSearchRepository.findAllByTraineeIdForDaily(trainee.getId(),
277-
date).orElse(new TraineeProjection.PtInfoDto(null, null, null, null));
277+
date).orElse(new TraineeProjection.PtInfoDto(null, null, null, null, null));
278278

279279
// PT 정보 Mapping to PtInfo
280280
GetTraineeDailyRecordsResponse.PtInfo ptInfo = new GetTraineeDailyRecordsResponse.PtInfo(ptResult.trainerName(),
281-
ptResult.session(), ptResult.lessonStart(), ptResult.lessonEnd());
281+
ptResult.trainerProfileImage(), ptResult.session(), ptResult.lessonStart(), ptResult.lessonEnd());
282282

283283
// 식단 정보 조회
284284
List<Diet> diets = dietService.getDietsWithTraineeIdForDaily(trainee.getId(), date);

src/main/java/com/tnt/dto/trainee/TraineeProjection.java

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public class TraineeProjection {
1313
@QueryProjection
1414
public record PtInfoDto(
1515
String trainerName,
16+
String trainerProfileImage,
1617
Integer session,
1718
LocalDateTime lessonStart,
1819
LocalDateTime lessonEnd

src/main/java/com/tnt/dto/trainee/response/GetTraineeDailyRecordsResponse.java

+3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ public record PtInfo(
2525
@Schema(description = "트레이너 이름", example = "홍길동", nullable = false)
2626
String trainerName,
2727

28+
@Schema(description = "트레이너 프로필 사진", nullable = false)
29+
String trainerProfileImage,
30+
2831
@Schema(description = "PT 회차", example = "8", nullable = false)
2932
Integer session,
3033

src/main/java/com/tnt/infrastructure/mysql/repository/pt/PtLessonSearchRepository.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,18 @@ public boolean existsByStartAndEnd(PtTrainerTrainee pt, LocalDateTime start, Loc
100100
public Optional<TraineeProjection.PtInfoDto> findAllByTraineeIdForDaily(Long traineeId, LocalDate date) {
101101
return Optional.ofNullable(
102102
jpaQueryFactory
103-
.select(new QTraineeProjection_PtInfoDto(trainer.member.name, ptLesson.session, ptLesson.lessonStart,
104-
ptLesson.lessonEnd))
103+
.select(new QTraineeProjection_PtInfoDto(trainer.member.name, trainer.member.profileImageUrl,
104+
ptLesson.session, ptLesson.lessonStart, ptLesson.lessonEnd))
105105
.from(ptLesson)
106106
.join(ptLesson.ptTrainerTrainee, ptTrainerTrainee)
107107
.join(ptTrainerTrainee.trainer, trainer)
108+
.join(trainer.member, member)
108109
.where(ptTrainerTrainee.trainee.id.eq(traineeId),
109110
ptLesson.lessonStart.between(date.atStartOfDay(), date.atTime(LocalTime.MAX)),
110111
ptLesson.deletedAt.isNull(),
111112
ptTrainerTrainee.deletedAt.isNull(),
112-
trainer.deletedAt.isNull())
113+
trainer.deletedAt.isNull(),
114+
member.deletedAt.isNull())
113115
.fetchOne()
114116
);
115117
}

src/main/resources/config

0 commit comments

Comments
 (0)