Conversation
Summary of ChangesHello @Suhyeon7, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 PR은 사용자 경험을 개선하기 위해 추천 시스템의 동작 방식을 업데이트합니다. 기존에는 오늘의 추천이 준비되지 않았을 때 "대기 중" 상태를 반환했지만, 이제는 사용자에게 오늘의 추천이 없을 경우 자동으로 가장 최근의 추천 5개를 보여주도록 변경되었습니다. 이는 사용자가 항상 관련성 있는 콘텐츠를 볼 수 있도록 보장하며, 시스템이 추천을 생성하는 동안에도 유용한 정보를 제공합니다. 또한, 사용자 메모리 조회 시 데이터가 없을 경우 명확한 예외를 발생시키도록 처리되었습니다. Highlights
Ignored Files
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
이번 PR은 사용자의 오늘 추천이 없을 경우 최근 5개의 추천을 보여주는 기능을 추가하는 것을 목표로 하고 있습니다. 전반적으로 좋은 시도이지만, 몇 가지 개선할 점이 보입니다. HappyMemoryService에서는 메모리가 없을 때 예외를 던지는 대신 빈 목록을 반환하는 것이 API 설계 관점에서 더 좋습니다. RecommendationService에서는 특정 날짜의 추천을 조회할 때 의도치 않게 최근 추천이 반환되는 로직 오류가 있으며, 코드 중복도 발견되었습니다. 자세한 내용은 각 파일에 남긴 코멘트를 참고해주세요.
| if (recommendations.isEmpty()) { | ||
| log.info("[RecommendationService.getRecommendationsByDate] returning last 5 recommendations"); | ||
| recommendations = recommendationRepository.findByUserId( | ||
| userId, | ||
| PageRequest.of(0, 5, Sort.by(Sort.Direction.DESC, "createdAt")) | ||
| ); | ||
| } |
There was a problem hiding this comment.
특정 날짜(recommendDate)의 추천 내역이 없을 때 항상 최근 5개의 추천을 보여주는 현재 로직은 사용자가 과거 날짜를 조회할 때 혼란을 줄 수 있습니다. 예를 들어, 어제의 추천 기록을 보려 할 때 어제 추천이 없었다면 최근 추천(오늘 추천 등)이 표시될 수 있습니다.
요청된 날짜가 오늘(LocalDate.now())이고 추천 내역이 없을 때만 최근 5개를 보여주도록 수정하는 것이 좋겠습니다. 이렇게 하면 과거 날짜에 대한 조회는 의도대로 비어있는 목록을 반환하게 됩니다.
| if (recommendations.isEmpty()) { | |
| log.info("[RecommendationService.getRecommendationsByDate] returning last 5 recommendations"); | |
| recommendations = recommendationRepository.findByUserId( | |
| userId, | |
| PageRequest.of(0, 5, Sort.by(Sort.Direction.DESC, "createdAt")) | |
| ); | |
| } | |
| if (recommendations.isEmpty() && recommendDate.equals(LocalDate.now())) { | |
| log.info("[RecommendationService.getRecommendationsByDate] returning last 5 recommendations as today's are not available"); | |
| recommendations = recommendationRepository.findByUserId( | |
| userId, | |
| PageRequest.of(0, 5, Sort.by(Sort.Direction.DESC, "createdAt")) | |
| ); | |
| } |
| if (memories.isEmpty()) { | ||
| throw new CustomException(ErrorCode.MEMORY_NOT_FOUND); | ||
| } |
| if (recommendations.isEmpty()) { | ||
| log.info("[RecommendationService.getRecommendations] returning PENDING status"); | ||
| return RecommendationListResponse.pending(); | ||
| // 오늘 추천 없으면 최근 5개를 createdAt 내림차순으로 가져오기 | ||
| log.info("[RecommendationService.getRecommendations] returning last 5 recommendations"); | ||
| recommendations = recommendationRepository.findByUserId( | ||
| userId, | ||
| PageRequest.of(0, 5, Sort.by(Sort.Direction.DESC, "createdAt")) | ||
| ); | ||
| } |
| FILE_SIZE_EXCEEDED(HttpStatus.PAYLOAD_TOO_LARGE, "FILE_413", "파일 크기가 허용 용량을 초과했습니다."), | ||
| MAX_IMAGE_EXCEEDED(HttpStatus.BAD_REQUEST, "MEMORY_004", "이미지는 최대 4개까지만 업로드 가능합니다"), | ||
| INVALID_CANDY_COLOR(HttpStatus.BAD_REQUEST, "CANDY_401", "캔디 색상은 YELLOW, ORANGE, PINK, GREEN, BLUE 중 하나여야 합니다."), | ||
| MEMORY_NOT_FOUND(HttpStatus.NOT_FOUND, "MEMORY_404", "사용자의 메모리를 찾을 수 없습니다."), |
작업 내용
변경 사항
관련 이슈
closes #