Skip to content

Commit ec18d23

Browse files
authored
feat(report): 답변 상세 조회 응답에 dailyReportId 추가 (#171)
캘린더/답변 상세에서 댓글·좋아요 기능 진입을 위해 GET /answers/{answerId}, GET /answers/calendar/{date}, GET /daily-reports/{reportId} 응답에 dailyReportId 필드 추가
1 parent 635a7e6 commit ec18d23

5 files changed

Lines changed: 10 additions & 2 deletions

File tree

src/main/java/com/devkor/ifive/nadab/domain/dailyreport/api/AnswerController.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ public ResponseEntity<ApiResponseDto<SearchAnswerEntryResponse>> searchAnswers(
9999
description = """
100100
답변 ID로 해당 답변의 상세 정보와 리포트를 조회합니다.
101101
102+
- 일간 리포트 ID (dailyReportId, 리포트 없으면 null)
102103
- 질문 내용 (questionText)
103104
- 질문 카테고리 (interestCode)
104105
- 답변 작성일 (answerDate)
@@ -206,6 +207,7 @@ public ResponseEntity<ApiResponseDto<CalendarRecentsResponse>> getCalendarRecent
206207
특정 날짜의 답변 전체 정보를 조회합니다.
207208
208209
응답 데이터:
210+
- 일간 리포트 ID (dailyReportId, 리포트 없으면 null)
209211
- 질문 내용 (questionText)
210212
- 질문 카테고리 (interestCode)
211213
- 답변 작성일 (answerDate)

src/main/java/com/devkor/ifive/nadab/domain/dailyreport/api/dto/response/AnswerDetailResponse.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
@Schema(description = "답변 상세 조회 응답")
99
public record AnswerDetailResponse(
1010

11+
@Schema(description = "일간 리포트 ID (댓글·좋아요 조회 시 사용)", example = "42")
12+
Long dailyReportId,
13+
1114
@Schema(description = "질문 내용", example = "오늘 가장 기뻤던 순간은?")
1215
String questionText,
1316

@@ -31,6 +34,7 @@ public record AnswerDetailResponse(
3134
) {
3235
public static AnswerDetailResponse from(AnswerDetailDto dto, String imageUrl) {
3336
return new AnswerDetailResponse(
37+
dto.dailyReportId(),
3438
dto.questionText(),
3539
dto.interestCode() != null ? dto.interestCode().name() : null,
3640
dto.answerDate(),

src/main/java/com/devkor/ifive/nadab/domain/dailyreport/core/dto/AnswerDetailDto.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* Repository 쿼리 결과를 담는 DTO
1111
*/
1212
public record AnswerDetailDto(
13+
Long dailyReportId,
1314
String questionText,
1415
InterestCode interestCode,
1516
LocalDate answerDate,

src/main/java/com/devkor/ifive/nadab/domain/dailyreport/core/repository/AnswerEntryQueryRepository.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ List<SearchAnswerEntryDto> findRecentAnswers(
108108
*/
109109
@Query("""
110110
select new com.devkor.ifive.nadab.domain.dailyreport.core.dto.AnswerDetailDto(
111-
ae.question.questionText, ae.question.interest.code, ae.date, ae.content, dr.content, e.code, ae.imageKey
111+
dr.id, ae.question.questionText, ae.question.interest.code, ae.date, ae.content, dr.content, e.code, ae.imageKey
112112
)
113113
from AnswerEntry ae
114114
left join DailyReport dr on dr.answerEntry = ae and dr.status = com.devkor.ifive.nadab.domain.dailyreport.core.entity.DailyReportStatus.COMPLETED
@@ -126,7 +126,7 @@ Optional<AnswerDetailDto> findDetailByAnswerId(
126126
*/
127127
@Query("""
128128
select new com.devkor.ifive.nadab.domain.dailyreport.core.dto.AnswerDetailDto(
129-
ae.question.questionText, ae.question.interest.code, ae.date, ae.content, dr.content, e.code, ae.imageKey
129+
dr.id, ae.question.questionText, ae.question.interest.code, ae.date, ae.content, dr.content, e.code, ae.imageKey
130130
)
131131
from AnswerEntry ae
132132
left join DailyReport dr on dr.answerEntry = ae and dr.status = com.devkor.ifive.nadab.domain.dailyreport.core.entity.DailyReportStatus.COMPLETED

src/main/java/com/devkor/ifive/nadab/domain/dailyreport/core/repository/DailyReportRepository.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public interface DailyReportRepository extends JpaRepository<DailyReport, Long>
4444
*/
4545
@Query("""
4646
select new com.devkor.ifive.nadab.domain.dailyreport.core.dto.AnswerDetailDto(
47+
dr.id,
4748
q.questionText,
4849
i.code,
4950
ae.date,

0 commit comments

Comments
 (0)