Skip to content

Conversation

@eric-jy-park
Copy link
Member

@eric-jy-park eric-jy-park commented Aug 16, 2025

๐Ÿ“Œ PR ์ œ๋ชฉ

  • feat: add new api with additional field for response

๐Ÿ“‹ ์ž‘์—… ๋‚ด์šฉ

  • ํ˜„์žฌ ์ง„ํ–‰์ค‘์ธ ์„ธ์…˜ ๋ฐ˜ํ™˜ api ๊ตฌํ˜„
  • ์ข…๋ฃŒ๋œ ์„ธ์…˜ ๋ฐ˜ํ™˜ api์˜ response์— ์ด์ „/์ตœ์‹  sr ํ•„๋“œ ์ถ”๊ฐ€

โœ… ์ฒดํฌ๋ฆฌ์ŠคํŠธ

  • ํ…Œ์ŠคํŠธ๋ฅผ ์™„๋ฃŒํ–ˆ๋‚˜์š”?
  • ์ฝ”๋“œ ์ปจ๋ฒค์…˜์„ ์ง€์ผฐ๋‚˜์š”?
  • ๊ด€๋ จ ๋ฌธ์„œ๋ฅผ ์—…๋ฐ์ดํŠธ ํ–ˆ๋‚˜์š”?

๐Ÿšจ ์ฃผ์˜์‚ฌํ•ญ

  • ๋ฆฌ๋ทฐ์–ด๊ฐ€ ์ฃผ์˜๊นŠ๊ฒŒ ๋ด์•ผํ•  ๋ถ€๋ถ„์ด ์žˆ๋‹ค๋ฉด ์ ์–ด์ฃผ์„ธ์š”.

@eric-jy-park eric-jy-park requested review from 1117mg and Copilot August 16, 2025 13:38
@eric-jy-park eric-jy-park self-assigned this Aug 16, 2025
@claude
Copy link

claude bot commented Aug 16, 2025

Claude finished @eric-jy-park's task โ€”โ€” View job


์ฝ”๋“œ ๋ฆฌ๋ทฐ ์™„๋ฃŒ

์ž‘์—… ๋ชฉ๋ก

  • ๋ณ€๊ฒฝ๋œ ํŒŒ์ผ๋“ค ๋ถ„์„
  • ์ฝ”๋“œ ๋ฆฌ๋ทฐ ์ˆ˜ํ–‰ (๋ฒ„๊ทธ, ๋ณด์•ˆ, ์„ฑ๋Šฅ, ๋ถˆ๋ถ„๋ช…ํ•œ ๋กœ์ง ์ค‘์‹ฌ)
  • ๋ฆฌ๋ทฐ ๊ฒฐ๊ณผ ์ž‘์„ฑ

๋ณ€๊ฒฝ์‚ฌํ•ญ ์š”์•ฝ

ํ˜„์žฌ ์ง„ํ–‰์ค‘์ธ ์„ธ์…˜ ์กฐํšŒ API(GET /api/sessions)๊ฐ€ ์ƒˆ๋กœ ์ถ”๊ฐ€๋˜์—ˆ๊ณ , ์ข…๋ฃŒ๋œ ์„ธ์…˜ ์กฐํšŒ API์˜ ์‘๋‹ต์— ์ด์ „ SR๊ณผ ํ˜„์žฌ SR ํ•„๋“œ๊ฐ€ ์ถ”๊ฐ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ์ปจํŠธ๋กค๋Ÿฌ์—๋Š” ์ƒˆ๋กœ์šด ์—”๋“œํฌ์ธํŠธ๊ฐ€ ์ถ”๊ฐ€๋˜์—ˆ๊ณ , DTO์—๋Š” ์ƒˆ๋กœ์šด ์‘๋‹ต ํด๋ž˜์Šค์™€ ๊ธฐ์กด ์‘๋‹ต ํด๋ž˜์Šค์— SR ๊ด€๋ จ ํ•„๋“œ๊ฐ€ ์ถ”๊ฐ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ์„œ๋น„์Šค ๋ ˆ์ด์–ด์—๋Š” ํ™œ์„ฑ ์„ธ์…˜ ์กฐํšŒ ๋ฉ”์†Œ๋“œ๊ฐ€ ์ถ”๊ฐ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

์ฝ”๋“œ ๋ฆฌ๋ทฐ

UserSessionController.java:112 - issue: ๋ถˆํ•„์š”ํ•œ UserService ํ˜ธ์ถœ๋กœ ์„ฑ๋Šฅ ์ €ํ•˜ - ์ด๋ฏธ ์„ธ์…˜์—์„œ userId ๊ฒ€์ฆ ํ›„ ๋ณ„๋„ DB ์กฐํšŒ๊ฐ€ ์ค‘๋ณต๋จ, UserSessionService์—์„œ User ์ •๋ณด๋ฅผ ํ•จ๊ป˜ ๋ฐ˜ํ™˜ํ•˜๋„๋ก ์ˆ˜์ • ๊ถŒ์žฅ

UserSessionResponses.java:67 - question: SR ๊ณ„์‚ฐ ๋กœ์ง์ด ๋ถˆ๋ถ„๋ช…ํ•จ - currentSr = user.getSr() + session.getSrGained() ๊ณ„์‚ฐ์ด ์˜ฌ๋ฐ”๋ฅธ์ง€ ํ™•์ธ ํ•„์š”, ์„ธ์…˜ ์ข…๋ฃŒ ์‹œ์ ์— ์ด๋ฏธ user.getSr()์— ๋ฐ˜์˜๋˜์—ˆ์„ ๊ฐ€๋Šฅ์„ฑ ๊ฒ€ํ† 

UserSessionServiceImpl.java:100 - suggestion: @transactional ์–ด๋…ธํ…Œ์ด์…˜์ด ๋ถˆํ•„์š”ํ•จ - ๋‹จ์ˆœ ์กฐํšŒ ๋ฉ”์†Œ๋“œ์—์„œ ์ฝ๊ธฐ ์ „์šฉ ํŠธ๋žœ์žญ์…˜ ์‚ฌ์šฉ ๊ถŒ์žฅ, @transactional(readOnly = true) ๋˜๋Š” ์ œ๊ฑฐ

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a new API endpoint to fetch the currently active user session and enhances the existing session response to include additional SR (Skill Rating) fields. The changes implement functionality to return ongoing sessions and provide more detailed SR information for completed sessions.

Key changes:

  • Added new getActiveSession method to retrieve the user's currently active session
  • Enhanced the session state response with currentSr and previousSr fields
  • Updated API documentation paths and added comprehensive documentation for the new endpoint

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
UserSessionServiceImpl.java Implements getActiveSession method to find active sessions by user ID
UserSessionService.java Adds interface method declaration for getActiveSession
UserSessionResponses.java Adds new response DTO for active sessions and enhances existing DTO with SR fields
UserSessionController.java Adds new GET endpoint for active sessions and updates existing endpoint to include user data

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@RequiredArgsConstructor
public class UserSessionController {
private final UserSessionService userSessionService;
private final UserRepository userRepository;
Copy link

Copilot AI Aug 16, 2025

Choose a reason for hiding this comment

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

The UserRepository field is injected but never used in this controller. Consider removing it since UserService is already available and provides the necessary user operations.

Suggested change
private final UserRepository userRepository;

Copilot uses AI. Check for mistakes.
response.totalDuration = session.getTotalDuration();
response.srGained = session.getSrGained();
response.currentSr = user.getSr() + session.getSrGained();
response.previousSr = user.getSr();
Copy link

Copilot AI Aug 16, 2025

Choose a reason for hiding this comment

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

The currentSr calculation adds srGained to the user's current SR, but this logic appears incorrect. If the session is finished, the user's SR should already include the gained SR. This would result in double-counting the SR gain.

Suggested change
response.previousSr = user.getSr();
response.currentSr = user.getSr();
response.previousSr = user.getSr() - session.getSrGained();

Copilot uses AI. Check for mistakes.
response.totalDuration = session.getTotalDuration();
response.srGained = session.getSrGained();
response.currentSr = user.getSr() + session.getSrGained();
response.previousSr = user.getSr();
Copy link

Copilot AI Aug 16, 2025

Choose a reason for hiding this comment

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

The previousSr is set to the user's current SR, but this should represent the SR before the session. If the user's SR has already been updated after the session, this would be incorrect. Consider storing the previous SR value or calculating it as user.getSr() - session.getSrGained().

Suggested change
response.previousSr = user.getSr();
response.previousSr = user.getSr() - session.getSrGained();

Copilot uses AI. Check for mistakes.
@claude
Copy link

claude bot commented Aug 16, 2025

Claude finished @eric-jy-park's task โ€”โ€” View job


์ฝ”๋“œ ๋ฆฌ๋ทฐ ์™„๋ฃŒ

์ž‘์—… ๋ชฉ๋ก

  • ๋ณ€๊ฒฝ๋œ ํŒŒ์ผ๋“ค ๋ถ„์„
  • ์ฝ”๋“œ ๋ฆฌ๋ทฐ ์ˆ˜ํ–‰ (๋ฒ„๊ทธ, ๋ณด์•ˆ, ์„ฑ๋Šฅ, ๋ถˆ๋ถ„๋ช…ํ•œ ๋กœ์ง ์ค‘์‹ฌ)
  • ๋ฆฌ๋ทฐ ๊ฒฐ๊ณผ ์ž‘์„ฑ

๋ณ€๊ฒฝ์‚ฌํ•ญ ์š”์•ฝ

ํ˜„์žฌ ์ง„ํ–‰์ค‘์ธ ์„ธ์…˜ ์กฐํšŒ API(GET /api/sessions)๊ฐ€ ์ƒˆ๋กœ ์ถ”๊ฐ€๋˜์—ˆ๊ณ , ์ข…๋ฃŒ๋œ ์„ธ์…˜ ์กฐํšŒ API์˜ ์‘๋‹ต์— ์ด์ „ SR๊ณผ ํ˜„์žฌ SR ํ•„๋“œ๊ฐ€ ์ถ”๊ฐ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ์ปจํŠธ๋กค๋Ÿฌ์—๋Š” ์ƒˆ๋กœ์šด ์—”๋“œํฌ์ธํŠธ๊ฐ€ ์ถ”๊ฐ€๋˜์—ˆ๊ณ , DTO์—๋Š” ์ƒˆ๋กœ์šด ์‘๋‹ต ํด๋ž˜์Šค์™€ ๊ธฐ์กด ์‘๋‹ต ํด๋ž˜์Šค์— SR ๊ด€๋ จ ํ•„๋“œ๊ฐ€ ์ถ”๊ฐ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ์„œ๋น„์Šค ๋ ˆ์ด์–ด์—๋Š” ํ™œ์„ฑ ์„ธ์…˜ ์กฐํšŒ ๋ฉ”์†Œ๋“œ๊ฐ€ ์ถ”๊ฐ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

์ฝ”๋“œ ๋ฆฌ๋ทฐ

UserSessionController.java:111 - issue: ๋ถˆํ•„์š”ํ•œ UserService ํ˜ธ์ถœ๋กœ ์„ฑ๋Šฅ ์ €ํ•˜ - ์ด๋ฏธ ์„ธ์…˜์—์„œ userId ๊ฒ€์ฆ ํ›„ ๋ณ„๋„ DB ์กฐํšŒ๊ฐ€ ์ค‘๋ณต๋จ, UserSessionService์—์„œ User ์ •๋ณด๋ฅผ ํ•จ๊ป˜ ๋ฐ˜ํ™˜ํ•˜๋„๋ก ์ˆ˜์ • ๊ถŒ์žฅ

UserSessionResponses.java:67 - question: SR ๊ณ„์‚ฐ ๋กœ์ง์ด ๋ถˆ๋ถ„๋ช…ํ•จ - currentSr = user.getSr() + session.getSrGained() ๊ณ„์‚ฐ์ด ์˜ฌ๋ฐ”๋ฅธ์ง€ ํ™•์ธ ํ•„์š”, ์„ธ์…˜ ์ข…๋ฃŒ ์‹œ์ ์— ์ด๋ฏธ user.getSr()์— ๋ฐ˜์˜๋˜์—ˆ์„ ๊ฐ€๋Šฅ์„ฑ ๊ฒ€ํ† 

UserSessionServiceImpl.java:100 - suggestion: @transactional ์–ด๋…ธํ…Œ์ด์…˜์ด ๋ถˆํ•„์š”ํ•จ - ๋‹จ์ˆœ ์กฐํšŒ ๋ฉ”์†Œ๋“œ์—์„œ ์ฝ๊ธฐ ์ „์šฉ ํŠธ๋žœ์žญ์…˜ ์‚ฌ์šฉ ๊ถŒ์žฅ, @transactional(readOnly = true) ๋˜๋Š” ์ œ๊ฑฐ

@eric-jy-park eric-jy-park merged commit 671e5f1 into main Aug 16, 2025
1 check passed
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.

2 participants