Skip to content

v6#48

Merged
joonamin merged 7 commits intomainfrom
develop
Feb 10, 2026
Merged

v6#48
joonamin merged 7 commits intomainfrom
develop

Conversation

@joonamin
Copy link
Copy Markdown
Collaborator

@joonamin joonamin commented Feb 9, 2026

  • 충돌 해결 후 합병예정

sezeme and others added 4 commits February 9, 2026 22:15
* refactor(security): update permitted endpoints and remove ChatController

- Updated SecurityConfig to restrict access by removing the chat endpoint from the permitted list.
- Deleted ChatController as it is no longer needed in the application.

* refactor(quiz): rename quiz class and delete quiz choice

* feat: add & fix mock data

* feat: rebase 마무리

* feat(data loader): add scene rank data

* fix: accept review

---------

Co-authored-by: DaehyeonKim <qwertypotter@gachon.ac.kr>
* refactor(security): update permitted endpoints and remove ChatController

- Updated SecurityConfig to restrict access by removing the chat endpoint from the permitted list.
- Deleted ChatController as it is no longer needed in the application.

* feat(quiz): get quiz list

* fix: order by quiz id

* fix(quiz): 정답을 프론트로 내려주지 않도록 수정, 객관식 채점 시 정답
올바르게 파싱하도록 수정

---------

Co-authored-by: DaehyeonKim <qwertypotter@gachon.ac.kr>
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @joonamin, 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!

이 풀 리퀘스트는 퀴즈 기능을 백엔드 시스템에 통합하고 초기 데이터 로딩 방식을 개선하는 데 중점을 둡니다. 새로운 퀴즈 관련 엔드포인트, 서비스 로직 및 데이터 모델이 추가되었으며, 기존 데이터 로더는 퀴즈와 통계 데이터를 외부 JSON 파일에서 동적으로 로드하도록 확장되었습니다. 또한, 특정 채팅 엔드포인트에 대한 보안 요구 사항이 강화되었습니다.

Highlights

  • 퀴즈 기능 도입: 새로운 퀴즈 엔티티, 서비스, 컨트롤러 및 관련 DTO가 추가되어 씬별 퀴즈를 제공하고 사용자 진행 상황을 관리합니다.
  • 초기 데이터 로딩 개선: DataLoader가 퀴즈 및 통계 데이터를 JSON 파일에서 로드하도록 업데이트되었으며, UserScene 관련 로직이 제거되었습니다.
  • 보안 설정 변경: /scenes/*/chat 엔드포인트에 대한 인증이 필수로 변경되었습니다.
  • 퀴즈 엔티티 리팩토링: SceneRanksQuiz 엔티티가 Quiz로 이름이 변경되고, 정답 처리 로직이 개선되었습니다.
Changelog
  • src/main/java/com/blaybus/backend/config/DataLoader.java
    • UserScene 관련 의존성 및 로직이 제거되었습니다.
    • QuizRepository, Quiz, QuizType 관련 의존성이 추가되었습니다.
    • 초기 씬, 컴포넌트, 퀴즈, 통계 데이터를 로드하는 새로운 메서드(loadInitialScenes, loadInitialComponents, loadInitialQuizzes, loadInitialStatistics)가 도입되었습니다.
    • createUserGrassIfNotExists 메서드에서 오늘 날짜의 초기 잔디 데이터 점수와 해결 문제 수가 0으로 설정되도록 변경되었습니다.
    • createSceneInformationIfNotExistscreateUserSceneIfNotExists 메서드가 삭제되었습니다.
    • loadInitialQuizzesloadInitialStatistics 메서드가 추가되어 각각 initial_quiz_data.jsoninitial_statistics_data.json 파일에서 데이터를 로드합니다.
  • src/main/java/com/blaybus/backend/config/SecurityConfig.java
    • /scenes/*/chat 엔드포인트가 인증 없이 접근 가능하도록 설정된 permitAll() 목록에서 제거되어, 이제 해당 엔드포인트에 접근하려면 인증이 필요합니다.
  • src/main/java/com/blaybus/backend/controller/QuizController.java
    • @RequestMapping 경로가 /scenes/{sceneId}/quiz에서 /scenes/{sceneId}/quizzes로 변경되었습니다.
    • QuizService가 주입되었습니다.
    • 특정 씬의 퀴즈 목록과 사용자 진행 상황을 조회하는 GET /scenes/{sceneId}/quizzes 엔드포인트가 추가되었습니다.
    • 사용자의 퀴즈 진행 상황을 동기화하는 PATCH /scenes/{sceneId}/quizzes/progress 엔드포인트가 추가되었습니다.
  • src/main/java/com/blaybus/backend/domain/quiz/Quiz.java
    • 클래스 이름이 SceneRanksQuiz에서 Quiz로 변경되었습니다.
    • 테이블 이름이 scene_ranks_quiz에서 quiz로 변경되었습니다.
    • answer 필드에 대한 주석이 업데이트되어 SELECT 타입 퀴즈의 경우 정답이 쉼표로 구분된 문자열 중 첫 번째 값임을 명시했습니다.
  • src/main/java/com/blaybus/backend/dto/QuizDto.java
    • 사용자 퀴즈 진행 상황 동기화를 위한 SyncProgressRequest 레코드가 추가되었습니다.
  • src/main/java/com/blaybus/backend/dto/QuizResponse.java
    • 새로운 파일로, 씬의 퀴즈 목록과 사용자 퀴즈 진행 상황을 포함하는 QuizResponse DTO가 정의되었습니다.
  • src/main/java/com/blaybus/backend/exception/CommonErrorCode.java
    • QUIZ_PROGRESS_NOT_FOUND 에러 코드가 추가되었습니다.
  • src/main/java/com/blaybus/backend/repository/QuizRepository.java
    • JpaRepository의 제네릭 타입이 SceneRanksQuiz에서 Quiz로 변경되었습니다.
    • existsByQuestion(String question)findAllBySceneIdOrderById(Long sceneId) 메서드가 추가되었습니다.
  • src/main/java/com/blaybus/backend/service/QuizGradingService.java
    • SceneRanksQuiz 대신 Quiz 엔티티를 사용하도록 업데이트되었습니다.
    • SELECT 타입 퀴즈의 채점 로직에서 정답이 answer 문자열의 첫 번째 요소로 처리되도록 변경되었습니다.
  • src/main/java/com/blaybus/backend/service/QuizService.java
    • 새로운 파일로, 씬별 퀴즈 조회 및 사용자 퀴즈 진행 상황 동기화 로직을 담당하는 QuizService가 추가되었습니다.
  • src/main/resources/data/initial_quiz_data.json
    • 새로운 파일로, 초기 퀴즈 데이터를 정의하는 JSON 파일이 추가되었습니다.
  • src/main/resources/data/initial_statistics_data.json
    • 새로운 파일로, 초기 통계 데이터를 정의하는 JSON 파일이 추가되었습니다.
  • src/test/java/com/blaybus/backend/config/DataLoaderIntegrationTest.java
    • DataLoader 생성자 호출 시 QuizRepository가 포함되도록 업데이트되었습니다.
  • src/test/java/com/blaybus/backend/service/QuizServiceTest.java
    • 새로운 파일로, QuizServicesyncProgress 메서드에 대한 단위 테스트가 추가되었습니다.
  • src/test/java/com/blaybus/backend/verification/ManualVerificationExportTest.java
    • DataLoader 생성자 호출 시 QuizRepository가 포함되도록 업데이트되었습니다.
Activity
  • joonamin 님이 풀 리퀘스트를 생성했습니다.
  • 풀 리퀘스트 제목은 "v6"이며, 설명은 "충돌 해결 후 합병예정"입니다.
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
Copy Markdown
Contributor

@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은 퀴즈 기능을 추가하고 관련 데이터 로딩 방식을 개선하는 중요한 변경사항을 포함하고 있습니다. 전반적으로 코드 구조가 잘 잡혀있고, 특히 DataLoader를 리팩토링하여 JSON 파일로부터 초기 데이터를 로드하도록 변경한 점은 유지보수성 측면에서 매우 훌륭한 개선입니다. 새로운 퀴즈 관련 API 엔드포인트와 서비스 로직도 잘 구현되었습니다. 다만, QuizGradingService에서 사용자의 퀴즈 진행 상황을 업데이트하는 로직에 데이터 정합성을 해칠 수 있는 잠재적인 버그를 발견했습니다. 해당 부분에 대한 리뷰 코멘트를 남겼으니 확인 후 수정 부탁드립니다.

Comment on lines +66 to +76
QuizUserProgress updated = QuizUserProgress.builder()
.id(progress.getId())
.user(progress.getUser())
.scene(progress.getScene())
.lastQuizId(quiz.getId())
.totalQuestions(progress.getTotalQuestions() + 1)
.success(correct ? progress.getSuccess() + 1 : progress.getSuccess())
.failure(correct ? progress.getFailure() : progress.getFailure() + 1)
.isComplete(progress.isComplete())
.solveTime(progress.getSolveTime())
.build();
.id(progress.getId())
.user(progress.getUser())
.scene(progress.getScene())
.lastQuizId(quiz.getId())
.totalQuestions(progress.getTotalQuestions() + 1)
.success(correct ? progress.getSuccess() + 1 : progress.getSuccess())
.failure(correct ? progress.getFailure() : progress.getFailure() + 1)
.isComplete(progress.isComplete())
.solveTime(progress.getSolveTime())
.build();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

퀴즈 채점 시 진행 상황을 업데이트하는 로직에서 totalQuestions 필드가 정답/오답 여부와 관계없이 항상 1씩 증가하고 있습니다. totalQuestions는 해당 씬의 전체 퀴즈 개수를 의미해야 하므로, 채점 시마다 변경되어서는 안 됩니다. 현재 로직은 사용자가 문제를 풀 때마다 전체 문항 수가 늘어나는 것처럼 데이터를 기록하여, 데이터 정합성에 문제가 발생합니다. 이는 프로젝트의 핵심 원칙인 **데이터 정합성(Consistency)**에 위배됩니다.

QuizServicegetSceneQuizzes 메소드에서는 QuizUserProgress가 처음 생성될 때 전체 퀴즈 개수로 올바르게 초기화하고 있습니다. 이 값을 그대로 유지해야 합니다.

따라서 .totalQuestions(progress.getTotalQuestions() + 1) 부분에서 + 1을 제거하여 기존 값을 유지하도록 수정해야 합니다.

Suggested change
QuizUserProgress updated = QuizUserProgress.builder()
.id(progress.getId())
.user(progress.getUser())
.scene(progress.getScene())
.lastQuizId(quiz.getId())
.totalQuestions(progress.getTotalQuestions() + 1)
.success(correct ? progress.getSuccess() + 1 : progress.getSuccess())
.failure(correct ? progress.getFailure() : progress.getFailure() + 1)
.isComplete(progress.isComplete())
.solveTime(progress.getSolveTime())
.build();
.id(progress.getId())
.user(progress.getUser())
.scene(progress.getScene())
.lastQuizId(quiz.getId())
.totalQuestions(progress.getTotalQuestions() + 1)
.success(correct ? progress.getSuccess() + 1 : progress.getSuccess())
.failure(correct ? progress.getFailure() : progress.getFailure() + 1)
.isComplete(progress.isComplete())
.solveTime(progress.getSolveTime())
.build();
QuizUserProgress updated = QuizUserProgress.builder()
.id(progress.getId())
.user(progress.getUser())
.scene(progress.getScene())
.lastQuizId(quiz.getId())
.totalQuestions(progress.getTotalQuestions())
.success(correct ? progress.getSuccess() + 1 : progress.getSuccess())
.failure(correct ? progress.getFailure() : progress.getFailure() + 1)
.isComplete(progress.isComplete())
.solveTime(progress.getSolveTime())
.build();
References
  1. 이 프로젝트는 데이터 정합성(Consistency)을 최우선으로 고려합니다. 제안된 변경은 totalQuestions 필드의 값을 잘못 증가시켜 데이터의 정합성을 해치므로 수정이 필요합니다. (link)

@sezeme
Copy link
Copy Markdown
Collaborator

sezeme commented Feb 10, 2026

gemini review 반영해주세욤

@joonamin
Copy link
Copy Markdown
Collaborator Author

이거 +1 성공여부 상관없이 증가하도록 작성하신거 의도하신건가요?? 아니면 그대로 리뷰반영하면되나요?? 흐름 한번만 더 리마인드해주시겠어요?

@joonamin
Copy link
Copy Markdown
Collaborator Author

채원님 이거 quiz 관련해서 로직 수정하다 보니까 API 단에서도 변경되어야할 지점들이 보입니다.
request 에서 totalQuizCount를 제거한다는 등... 솔직히 제출마감이 얼마 안남은 시점에서 예상치 못한 사이드이펙트가 우려됩니다..
그래서 일단 저 부분은 보안 측면에서도 취약점이지만 이대로 충돌만 해결하고 머지해놓겠습니다. 관련해서는 이슈로 남겨두겠습니다.

@joonamin joonamin merged commit 59b0a6c into main Feb 10, 2026
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