Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ on:
branches: [ "release" ]

jobs:
build:
test:
name: test
runs-on: ubuntu-latest

steps:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.codecozy.server.dto.response;

// 책갈피 전체 조회 API - 위치 정보 응답을 보낼 때 사용
public record BookmarkLocationInfoDto(
String placeName,
String address,
String latitude,
String longitude
) { }
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package com.codecozy.server.dto.response;

import java.util.List;

public record BookmarkResponse(
String date,
int markPage,
int markPercent,
List<String> location,
BookmarkLocationInfoDto location,
String uuid
) {}
18 changes: 11 additions & 7 deletions server/src/main/java/com/codecozy/server/service/BookService.java
Original file line number Diff line number Diff line change
Expand Up @@ -1705,11 +1705,15 @@ public ResponseEntity<DefaultResponse> getBookmark(Long memberId, String isbn) {
List<Bookmark> bookmarks = bookRecord.getBookmarks();
for (Bookmark bookmark : bookmarks) {
// 위치 List 저장
List<String> location = new ArrayList<>();
location.add(bookmark.getLocationInfo().getPlaceName());
location.add(bookmark.getLocationInfo().getAddress());
location.add(String.valueOf(bookmark.getLocationInfo().getLatitude()));
location.add(String.valueOf(bookmark.getLocationInfo().getLongitude()));
BookmarkLocationInfoDto locationDto = null;
LocationInfo locationInfo = bookmark.getLocationInfo();
if (locationInfo != null) {
locationDto = new BookmarkLocationInfoDto(
locationInfo.getPlaceName(),
locationInfo.getAddress(),
String.valueOf(locationInfo.getLatitude()),
String.valueOf(locationInfo.getLongitude()));
}

// 응답에 보낼 데이터들
int markPage = bookmark.getMarkPage();
Expand All @@ -1719,11 +1723,11 @@ public ResponseEntity<DefaultResponse> getBookmark(Long memberId, String isbn) {
if (bookRecord.getBookType() == BookType.PAPER_BOOK) {
// 페이지 -> 퍼센트 계산
int percent = converterService.pageToPercent(markPage, book.getTotalPage());
bookmarkList.add(new BookmarkResponse(dateStr, markPage, percent, location, bookmark.getUuid()));
bookmarkList.add(new BookmarkResponse(dateStr, markPage, percent, locationDto, bookmark.getUuid()));
} else { // 전자책, 오디오북이면
// 퍼센트 -> 페이지 계산
int page = converterService.percentToPage(markPage, book.getTotalPage());
bookmarkList.add(new BookmarkResponse(dateStr, page, markPage, location, bookmark.getUuid()));
bookmarkList.add(new BookmarkResponse(dateStr, page, markPage, locationDto, bookmark.getUuid()));
}
}

Expand Down