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
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: CI

on:
push:
branches: [ "release" ]
pull_request:
branches: [ "release" ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Load file in GitHub Repository
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

- name: Test file
working-directory: ./server
run: |
chmod +x ./gradlew
./gradlew clean test -Dspring.profiles.active=test
9 changes: 3 additions & 6 deletions .github/workflows/deploy-aws.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
name: CI/CD to AWS
name: CD to AWS

on:
push:
branches: [ "release" ]
pull_request:
branches: [ "release" ]

permissions:
id-token: write
Expand Down Expand Up @@ -45,12 +43,11 @@ jobs:
"[3].aladin['item-id-type']": "${{ secrets.AL_ITEM_ID_TYPE }}"
}

- name: Test and build bootJar
- name: Build bootJar
working-directory: ./server
run: |
chmod +x ./gradlew
./gradlew clean test -Dspring.profiles.active=test
./gradlew build -Dspring.profiles.active=prod -x test
./gradlew clean build -Dspring.profiles.active=prod -x test

- name: 빌드한 파일 이름 저장
run: |
Expand Down
2 changes: 1 addition & 1 deletion server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

group = 'com.codecozy'
version = '0.0.10-SNAPSHOT'
version = '0.0.11-SNAPSHOT'

java {
sourceCompatibility = '17'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,17 @@ public ResponseEntity<DefaultResponse> getReadingNote(Long memberId, String isbn
int markPercent = converterService.pageToPercent(markPage, totalPage);
String dateStr = converterService.dateToString(bookmark.getDate());

String locationName = null;
LocationInfo locationInfo = bookmark.getLocationInfo();
if (locationInfo != null) {
locationName = locationInfo.getPlaceName();
}

bookmarks.add(new BookmarkPreviewResponse(
dateStr,
markPage,
markPercent,
bookmark.getLocationInfo().getPlaceName(),
locationName,
bookmark.getUuid()
));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.ArrayList;
import java.util.List;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
Expand Down Expand Up @@ -257,6 +259,27 @@ void succeed2() {
}
}

@Test
@DisplayName("위치정보 없는 책갈피 등록 후 독서노트 정보 불러오기")
void getBookRecordWithBookmark() {
// given
Bookmark bookmark = Bookmark
.create(bookRecord, "3b7d", 50, null, LocalDate.of(2024, 12, 10));
List<Bookmark> bookmarks = new ArrayList<>();
bookmarks.add(bookmark);
when(bookmarkRepository.findTop3ByBookRecordOrderByDateDesc(bookRecord)).thenReturn(bookmarks);

// when
ResponseEntity<DefaultResponse> response = bookService.getReadingNote(member.getMemberId(), book.getIsbn());

// then
GetReadingNoteResponse found = (GetReadingNoteResponse) response.getBody().getData();
assertThat(found).isNotNull();
assertThat(found.bookmarks().size()).isEqualTo(1);
assertThat(found.bookmarks().get(0).uuid()).isEqualTo("3b7d");
assertThat(found.bookmarks().get(0).location()).isNull();
}

@Test
@DisplayName("북마크 수정 테스트")
void modifyBookmark() {
Expand Down