Skip to content

refactor(backend): 서비스 계층 코드 중복 제거 및 구조 개선#246

Merged
kubrickcode merged 1 commit intodevelop/shlee/refactorfrom
develop/shlee/235
Nov 25, 2025
Merged

refactor(backend): 서비스 계층 코드 중복 제거 및 구조 개선#246
kubrickcode merged 1 commit intodevelop/shlee/refactorfrom
develop/shlee/235

Conversation

@kubrickcode
Copy link
Owner

  • UserContentService: getUserOverride 제네릭 헬퍼로 4개 메서드의 반복 패턴 통합
  • UserContentService: getItemPrice 중복 DB 쿼리 제거 (2회→1회)
  • ContentWageService: calculateContentWageData로 80% 중복 로직 통합
  • ContentWageService: Promise.all로 병렬 처리 개선
  • 공통 상수 DEFAULT_CONTENT_ORDER_BY 추출 (ContentService, GroupService)
  • 매직 넘버 SECONDS_PER_HOUR 상수화

fix #235

- UserContentService: getUserOverride 제네릭 헬퍼로 4개 메서드의 반복 패턴 통합
- UserContentService: getItemPrice 중복 DB 쿼리 제거 (2회→1회)
- ContentWageService: calculateContentWageData로 80% 중복 로직 통합
- ContentWageService: Promise.all로 병렬 처리 개선
- 공통 상수 DEFAULT_CONTENT_ORDER_BY 추출 (ContentService, GroupService)
- 매직 넘버 SECONDS_PER_HOUR 상수화

fix #235
@kubrickcode
Copy link
Owner Author

/gemini review

@gemini-code-assist
Copy link

Summary of Changes

Hello @kubrickcode, 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은 백엔드 서비스 계층의 코드 중복을 제거하고 구조를 개선하는 데 중점을 둡니다. 사용자별 오버라이드 로직을 처리하는 제네릭 헬퍼 함수를 도입하고, 임금 계산 로직을 통합하며, 공통 상수를 추출하여 코드의 재사용성, 가독성 및 전반적인 효율성을 향상시킵니다. 이러한 변경 사항은 시스템의 유지보수성을 높이고 잠재적인 성능 병목 현상을 줄이는 데 기여합니다.

Highlights

  • UserContentService 리팩토링: getUserOverride 제네릭 헬퍼 함수를 도입하여 네 가지 메서드(getContentDuration, getContentRewardAverageQuantity, getContentRewardIsSellable, getContentSeeMoreRewardQuantity)에서 반복되는 사용자 오버라이드 패턴을 통합했습니다.
  • UserContentService 중복 쿼리 제거: getItemPrice 메서드에서 중복되는 데이터베이스 쿼리를 제거하여 효율성을 높였습니다.
  • ContentWageService 로직 통합: calculateContentWageData 프라이빗 메서드를 생성하여 getContentGroupWage 및 getContentWage 메서드 내 80%에 달하는 중복 로직을 통합했습니다.
  • ContentWageService 병렬 처리 개선: getContentGroupWage 메서드에서 Promise.all을 사용하여 여러 콘텐츠에 대한 임금 데이터 계산을 병렬로 처리하도록 개선했습니다.
  • 공통 상수 추출: ContentService 및 GroupService에서 사용되던 기본 콘텐츠 정렬 순서(DEFAULT_CONTENT_ORDER_BY)를 공통 상수로 추출하여 중앙 관리 및 재사용성을 높였습니다.
  • 매직 넘버 상수화: ContentWageService 내 매직 넘버 3600을 SECONDS_PER_HOUR 상수로 대체하여 코드의 가독성과 유지보수성을 향상시켰습니다.
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

이번 PR은 서비스 계층의 코드 중복을 제거하고 구조를 개선하는 리팩토링을 중심으로 진행되었습니다. 전반적으로 코드의 가독성과 유지보수성, 그리고 성능이 크게 향상된 좋은 변경이라고 생각합니다. 특히 UserContentServicegetUserOverride 제네릭 헬퍼를 도입하여 반복적인 로직을 통합한 점과 ContentWageService에서 Promise.all을 사용하여 병렬 처리를 개선한 점이 인상적입니다. 몇 가지 추가적인 성능 개선 및 코드 간결성 향상을 위한 제안을 드립니다.

@kubrickcode kubrickcode merged commit 25bc324 into develop/shlee/refactor Nov 25, 2025
11 checks passed
@kubrickcode kubrickcode deleted the develop/shlee/235 branch November 25, 2025 13:39
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