Skip to content

Commit 4990849

Browse files
authored
refactor: 홈화면 API 응답 DTO에 isbn13필드 추가 (#82)
* [BOOK-236] refactor: apis - UserHomeResponse에서 RecentBookResponse에 isbn13 필드 추가 * [BOOK-236] fix: apis - isbn13 필드로 네이밍 수정 및 스웨거 명세 추가
1 parent c0d258b commit 4990849

File tree

1 file changed

+52
-12
lines changed

1 file changed

+52
-12
lines changed
Lines changed: 52 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,67 @@
11
package org.yapp.apis.home.dto.response
22

3+
import io.swagger.v3.oas.annotations.media.Schema
34
import org.yapp.domain.userbook.vo.HomeBookVO
45
import java.time.LocalDateTime
56
import java.util.*
67

8+
@Schema(
9+
description = "사용자 홈 화면 응답 DTO", name = "UserHomeResponse"
10+
)
711
data class UserHomeResponse private constructor(
8-
val recentBooks: List<RecentBookResponse>
12+
@Schema(
13+
description = "사용자가 최근에 읽은 책 목록", name = "recentBooks"
14+
) val recentBooks: List<RecentBookResponse>
915
) {
10-
data class RecentBookResponse(
11-
val userBookId: UUID,
12-
val title: String,
13-
val author: String,
14-
val publisher: String,
15-
val coverImageUrl: String,
16-
val lastRecordedAt: LocalDateTime,
17-
val recordCount: Int
16+
@Schema(
17+
description = "최근 읽은 책 한 권의 상세 정보", name = "RecentBookResponse"
18+
)
19+
data class RecentBookResponse private constructor(
20+
@Schema(
21+
description = "사용자 서재에 등록된 책의 고유 ID",
22+
example = "123e4567-e89b-12d3-a456-426614174000",
23+
) val userBookId: UUID,
24+
25+
@Schema(
26+
description = "책의 ISBN-13",
27+
example = "9788960777330",
28+
) val isbn13: String,
29+
30+
@Schema(
31+
description = "책 제목",
32+
example = "모던 자바스크립트 Deep Dive",
33+
) val title: String,
34+
35+
@Schema(
36+
description = "저자",
37+
example = "이웅모",
38+
) val author: String,
39+
40+
@Schema(
41+
description = "출판사",
42+
example = "위키북스",
43+
) val publisher: String,
44+
45+
@Schema(
46+
description = "책 표지 이미지 URL",
47+
example = "https://image.aladin.co.kr/product/2523/21/cover/8960777330_1.jpg",
48+
) val coverImageUrl: String,
49+
50+
@Schema(
51+
description = "마지막 독서 기록 시간",
52+
example = "2025-08-07T10:00:00",
53+
) val lastRecordedAt: LocalDateTime,
54+
55+
@Schema(
56+
description = "해당 책에 대한 총 독서 기록 수",
57+
example = "12",
58+
) val recordCount: Int
1859
) {
1960
companion object {
2061
fun from(userBookInfo: HomeBookVO): RecentBookResponse {
2162
return RecentBookResponse(
2263
userBookId = userBookInfo.id.value,
64+
isbn13 = userBookInfo.bookIsbn13.value,
2365
title = userBookInfo.title,
2466
author = userBookInfo.author,
2567
publisher = userBookInfo.publisher,
@@ -33,9 +75,7 @@ data class UserHomeResponse private constructor(
3375

3476
companion object {
3577
fun from(recentBooks: List<HomeBookVO>): UserHomeResponse {
36-
return UserHomeResponse(
37-
recentBooks = recentBooks.map { RecentBookResponse.from(it) }
38-
)
78+
return UserHomeResponse(recentBooks = recentBooks.map { RecentBookResponse.from(it) })
3979
}
4080
}
4181
}

0 commit comments

Comments
 (0)