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
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

@RestController
@RequiredArgsConstructor
@RequestMapping("/api/movie/appearance")
@RequestMapping("/api/movies/appearance")
public class AppearanceController {
private final AppearanceService appearanceService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class AppearanceResponse {

public static AppearanceResponse fromContent(Contents contents) {
return AppearanceResponse.builder()
.contentId(contents.getContentId())
.contentId(contents.getId())
.category(contents.getCategory())
.title(contents.getTitle())
.writer(contents.getWriter())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@
@Table(name="contents")
@NoArgsConstructor
public class Contents {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "content_id")
private Long contentId;
private Long id;

@Column(nullable = false, length = 10)
private String category;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ public interface ContentsRepository extends JpaRepository<Contents, Long> {
JOIN
actor_appearances aa ON a.actor_id = aa.actor_id
JOIN
contents c ON aa.contents_id = c.content_id
contents c ON aa.contents_id = c.id
WHERE
a.actor_name = :actorName
ORDER BY
c.content_id ASC
c.id ASC
LIMIT :limit OFFSET :offset
""", nativeQuery = true)
List<Contents> findContentsByActorName(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void fetchBooksForAllPages(int maxResults) throws JsonProcessingException
String pageResponse = bookApiClient.fetchBooksByPage(page, maxResults);
JsonNode items = objectMapper.readTree(pageResponse).path("item");

List<Contents> contentsList = AladinUtils.parseContentsData(items, "Book");
List<Contents> contentsList = AladinUtils.parseContentsData(items, "BOOK");
saveContentsToDatabase(contentsList);
}

Expand All @@ -67,7 +67,7 @@ public void saveNewBookWithLimit100() throws JsonProcessingException {
String pageResponse = bookApiClient.fetchBooksByPage(page, maxResults);
JsonNode items = objectMapper.readTree(pageResponse).path("item");

List<Contents> contentsList = AladinUtils.parseContentsData(items, "Book");
List<Contents> contentsList = AladinUtils.parseContentsData(items, "BOOK");
saveContentsToDatabase(contentsList);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void saveContentsToDatabase_ShouldIgnoreDuplicateBooks() {
when(contentsRepository.findAllTitlesAndWriters()).thenReturn(existingTitlesAndWriters);

List<Contents> contentsList = IntStream.range(1, 6)
.mapToObj(i -> Contents.of("Book", "Title" + i, "Author" + i, "Description" + i, "https://example.com/image" + i + ".jpg"))
.mapToObj(i -> Contents.of("BOOK", "Title" + i, "Author" + i, "Description" + i, "https://example.com/image" + i + ".jpg"))
.collect(Collectors.toList());

// When
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void parseContentsData_ShouldReturnContentsList() throws JsonProcessingException
JsonNode items = objectMapper.readTree(mockJson).path("item");

// when
List<Contents> contentsList = AladinUtils.parseContentsData(items, "Book");
List<Contents> contentsList = AladinUtils.parseContentsData(items, "BOOK");

// then
SoftAssertions softly = new SoftAssertions();
Expand Down Expand Up @@ -268,7 +268,7 @@ void parseContentsData_shouldTruncateSummaryIfExceeds300Characters() throws Exce
JsonNode items = objectMapper.readTree(jsonData).path("item");

// when
List<Contents> contentsList = AladinUtils.parseContentsData(items, "Book");
List<Contents> contentsList = AladinUtils.parseContentsData(items, "BOOK");

// then
assertThat(contentsList).hasSize(2);
Expand Down
Loading