Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] 리뷰 조회 쿼리파라미터 수정, 기록 없을 때 키워드 빈 리스트 반환하도록 수정 #44

Merged
merged 1 commit into from
May 29, 2024
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 @@ -29,12 +29,14 @@ public class RecordGetService {
private static final int HOME_RECORDS_BY_USER = 5;
private static final int HOME_RECORDS = 10;

public RecordResponse.RecordDetailResponse getRecord(Long userId, Long movieId) {
Optional<Record> record = recordQueryService.findByUserIdAndMovieId(userId, movieId);
public RecordResponse.RecordDetailResponse getRecord(Long userId, String tmdbId) {
Movie movie = movieQueryService.findByTmdbId(tmdbId);
Optional<Record> record = recordQueryService.findByUserIdAndMovieId(userId, movie.getId());
if(record.isEmpty()) {
List<String> keyword = new ArrayList<>();
return RecordResponse.RecordDetailResponse.builder()
.date(null)
.keywords(null)
.keywords(keyword)
.rating(null)
.review(null)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ public void createRecord(@RequestBody RecordRequest.RecordCreateRequest recordCr
}

@GetMapping("/record")
public RecordResponse.RecordDetailResponse getRecord(@RequestParam Long userId, @RequestParam Long movieId) {
return recordGetService.getRecord(userId, movieId);
public RecordResponse.RecordDetailResponse getRecord(@RequestParam Long userId, @RequestParam String tmdbId) {
return recordGetService.getRecord(userId, tmdbId);
}

@DeleteMapping("/record")
Expand Down
Loading