Skip to content

refactor: sortOrder 삭제#19

Merged
AlphaBs merged 1 commit intodevelopfrom
refactor/sortorder
Jan 10, 2026
Merged

refactor: sortOrder 삭제#19
AlphaBs merged 1 commit intodevelopfrom
refactor/sortorder

Conversation

@AlphaBs
Copy link
Member

@AlphaBs AlphaBs commented Jan 10, 2026

작업 내용

변경 사항

관련 이슈

closes #

@gemini-code-assist
Copy link

Summary of Changes

Hello @AlphaBs, 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은 추천 시스템의 핵심 엔티티인 DefaultRecommendation과 UserRecommendation에서 더 이상 사용되지 않는 'sortOrder' 필드를 제거하여 코드베이스를 간소화하고 데이터 모델을 최적화하는 것을 목표로 합니다. 이 변경은 엔티티, DTO, 서비스 및 리포지토리 계층 전반에 걸쳐 일관성을 유지하며, 불필요한 데이터 관리 오버헤드를 줄입니다.

Highlights

  • sortOrder 필드 제거: DefaultRecommendation 및 UserRecommendation 엔티티에서 'sortOrder' 필드를 완전히 제거했습니다. 이는 데이터베이스 스키마, 관련 DTO, 서비스 로직 및 목(mock) 데이터 생성 로직 전반에 걸쳐 반영되었습니다.
  • 데이터베이스 스키마 변경 필요: sortOrder 필드 제거에 따라, 데이터베이스의 default_recommendationsuser_recommendations 테이블에서 sort_order 컬럼을 수동으로 삭제해야 합니다.
  • 정렬 로직 변경: 더 이상 'sortOrder' 필드를 기준으로 정렬하지 않으며, 관련 리포지토리 메서드(findAllByOrderBySortOrderAsc) 호출이 findAll()로 변경되었습니다.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

sortOrder 필드를 제거하는 리팩토링 작업을 확인했습니다. 전반적으로 관련 코드들이 잘 수정되었지만, sortOrder가 담당하던 정렬 기능이 사라지면서 추천 목록의 순서가 보장되지 않는 문제가 발생할 수 있습니다. 특히 DefaultRecommendationUserRecommendation을 조회할 때 id를 기준으로 정렬하여 생성 순서를 유지하는 것이 좋아 보입니다. 또한, ERD.md 문서의 DDL 구문도 함께 최신화하면 문서의 일관성을 높일 수 있을 것입니다. 자세한 내용은 각 파일에 남긴 리뷰 코멘트를 참고해주세요.


private void saveDefaultRecommendations(Long userId) {
List<DefaultRecommendation> defaults = defaultRecommendationRepository.findAllByOrderBySortOrderAsc();
List<DefaultRecommendation> defaults = defaultRecommendationRepository.findAll();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

findAll() 메서드는 결과의 순서를 보장하지 않습니다. 기존에는 sortOrder를 기준으로 정렬했지만, 이 필드가 삭제되면서 정렬 기준이 사라졌습니다. 기본 추천 목록의 순서가 중요하다면 id를 기준으로 정렬하는 것이 좋습니다.
DefaultRecommendationRepositoryfindAllByOrderByIdAsc() 메서드를 추가하고 여기에서 호출하는 것을 권장합니다. 이렇게 하면 추천 목록이 항상 일관된 순서로 반환됩니다.

Suggested change
List<DefaultRecommendation> defaults = defaultRecommendationRepository.findAll();
List<DefaultRecommendation> defaults = defaultRecommendationRepository.findAllByOrderByIdAsc();

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

정렬안해도되요!

if (Boolean.TRUE.equals(user.getUseDefaultRecommendation())) {
log.info("[RecommendationService.getRecommendationsByDate] returning default recommendations");
List<DefaultRecommendation> defaults = defaultRecommendationRepository.findAllByOrderBySortOrderAsc();
List<DefaultRecommendation> defaults = defaultRecommendationRepository.findAll();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

findAll() 메서드는 결과의 순서를 보장하지 않습니다. 기존에는 sortOrder를 기준으로 정렬했지만, 이 필드가 삭제되면서 정렬 기준이 사라졌습니다. 기본 추천 목록의 순서가 중요하다면 id를 기준으로 정렬하는 것이 좋습니다.
DefaultRecommendationRepositoryfindAllByOrderByIdAsc() 메서드를 추가하고 여기에서 호출하는 것을 권장합니다. 이렇게 하면 추천 목록이 항상 일관된 순서로 반환됩니다.

Suggested change
List<DefaultRecommendation> defaults = defaultRecommendationRepository.findAll();
List<DefaultRecommendation> defaults = defaultRecommendationRepository.findAllByOrderByIdAsc();

}
```

Note: The `sort_order` columns have been removed. Drop `sort_order` from both `default_recommendations` and `user_recommendations` tables in the database.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

sort_order 컬럼이 삭제된 것을 명시하는 좋은 노트입니다. 다만, 문서의 일관성을 위해 몇 가지 개선점을 제안합니다.

  1. 이 문서의 다른 부분에 있는 DDL(데이터 정의 언어) 구문도 함께 업데이트하여 sort_order 컬럼을 제거하는 것이 좋습니다. 현재 DDL에는 sort_order가 남아있어 혼란을 줄 수 있습니다. (129, 132, 143 라인)
  2. 문서의 나머지 부분이 한국어로 작성되어 있으므로, 이 노트도 한국어로 번역하면 통일성을 높일 수 있습니다.

예시:
참고: 'sort_order' 컬럼이 제거되었습니다. 데이터베이스의 'default_recommendations'와 'user_recommendations' 테이블에서 해당 컬럼을 삭제해야 합니다.

@AlphaBs AlphaBs merged commit 860fe80 into develop Jan 10, 2026
1 check passed
@AlphaBs AlphaBs deleted the refactor/sortorder branch January 10, 2026 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant