Skip to content

[Feat] 선택 문항 응답에 직접 추가 여부 추가#83

Merged
whc9999 merged 2 commits into
mainfrom
feat/#39-question-select-custom
May 26, 2026
Merged

[Feat] 선택 문항 응답에 직접 추가 여부 추가#83
whc9999 merged 2 commits into
mainfrom
feat/#39-question-select-custom

Conversation

@whc9999
Copy link
Copy Markdown
Collaborator

@whc9999 whc9999 commented May 26, 2026

✨ 어떤 이유로 PR를 하셨나요?

  • feature 병합
  • 버그 수정(아래에 issue #를 남겨주세요)
  • 코드 개선
  • 코드 수정
  • 배포
  • 기타(아래에 자세한 내용 기입해주세요)

📋 세부 내용 - 왜 해당 PR이 필요한지 작업 내용을 자세하게 설명해주세요

  • QuestionResponse에 custom 필드 추가
  • 선택 문항 조회 응답에서 기본 문항과 직접 추가 문항을 구분하도록 수정
  • 선택 문항 저장 및 답변 저장 응답에도 custom 값이 포함되도록 반영
  • 선택 문항 조회 시 custom 값 반환 테스트 추가

📸 작업 화면 스크린샷

⚠️ PR하기 전에 확인해주세요

  • 로컬테스트를 진행하셨나요?
  • 머지할 브랜치를 확인하셨나요?
  • 관련 label을 선택하셨나요?

🚨 관련 이슈 번호 [#39 ]

Summary by CodeRabbit

  • New Features

    • Question responses now include a custom flag so clients can tell user-added questions from defaults.
    • Selected/saved question endpoints consistently include full question metadata and the custom flag.
  • Tests

    • Unit tests strengthened to verify content, character limits, and the new custom flag for questions.

Review Change Stack

- QuestionResponse에 custom 필드 추가
- 선택 문항 조회 응답에서 기본 문항과 직접 추가 문항을 구분하도록 수정
- 선택 문항 저장 및 답변 저장 응답에도 custom 값이 포함되도록 반영
- 선택 문항 조회 시 custom 값 반환 테스트 추가
@whc9999 whc9999 self-assigned this May 26, 2026
@whc9999 whc9999 added the ✨ feat New feature or request label May 26, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ab3eac1a-fcfc-445b-806e-6eb9723edc1f

📥 Commits

Reviewing files that changed from the base of the PR and between 655aa4a and 569d72e.

📒 Files selected for processing (2)
  • src/main/java/com/jobdri/jobdri_api/domain/analysis/dto/response/QuestionResponse.java
  • src/test/java/com/jobdri/jobdri_api/domain/analysis/service/QuestionServiceTest.java
💤 Files with no reviewable changes (1)
  • src/main/java/com/jobdri/jobdri_api/domain/analysis/dto/response/QuestionResponse.java

📝 Walkthrough

Walkthrough

Adds a custom boolean to QuestionResponse and replaces its single-arg factory with a two-arg overload; QuestionService centralizes custom-flag computation via isCustomQuestion and toQuestionResponse; tests are updated to assert the custom flag and related fields.

Changes

Question Response Custom Flag Enhancement

Layer / File(s) Summary
QuestionResponse DTO schema and factory methods
src/main/java/com/jobdri/jobdri_api/domain/analysis/dto/response/QuestionResponse.java
QuestionResponse record adds a custom boolean component and exposes from(Question, boolean custom) to construct the DTO with question.getAnswer() and the provided custom flag.
QuestionService custom flag propagation
src/main/java/com/jobdri/jobdri_api/domain/analysis/service/QuestionService.java
Introduces isCustomQuestion to detect non-default questions and toQuestionResponse to map entities to QuestionResponse.from(question, custom). Replaces direct QuestionResponse::from mappings in getSelectedQuestions, saveSelectedQuestions, and saveAnswers. Refactors validateCustomCandidate to reuse isCustomQuestion.
Test updates for custom flag and assertions
src/test/java/com/jobdri/jobdri_api/domain/analysis/service/QuestionServiceTest.java
Adds tuple static import, updates test input data, expands assertions in saveSelectedQuestions and replacement tests to check content, charLimit, and custom, and adds getSelectedQuestionsReturnsCustomFlag to verify returned custom values.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • JobDri-Developer/BackEnd#72: Both PRs extend handling of user-added "custom" questions and propagate a custom flag through QuestionService and related DTOs.

Poem

🐰 A tiny flag hops into the record line by line,
Now each question knows if it's yours or from the vine.
The service maps it once, so answers flow in tune,
Tests nod with tuples under a gentle moon.
Hooray — custom or default, every response can shine!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: adding a custom field to question responses to distinguish user-added questions from default options.
Description check ✅ Passed The description follows the template structure with checked feature checkbox, detailed implementation summary, completed pre-merge checklist items, and related issue reference.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/#39-question-select-custom

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
src/main/java/com/jobdri/jobdri_api/domain/analysis/dto/response/QuestionResponse.java (1)

12-14: ⚡ Quick win

Make custom explicit at the factory boundary.

The single-arg factory silently hardcodes custom=false, which can mislabel responses if reused later. Prefer removing this overload (or renaming it to an explicit default-only variant) so callers must provide intent.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@src/main/java/com/jobdri/jobdri_api/domain/analysis/dto/response/QuestionResponse.java`
around lines 12 - 14, The one-arg factory method QuestionResponse.from(Question)
silently hardcodes custom=false; remove this overload so callers must call
QuestionResponse.from(Question, boolean) with an explicit custom value (or
alternatively rename the single-arg variant to something like
fromDefaultForTests to signal the hardcoded intent). Update all call sites that
used QuestionResponse.from(Question) to pass an explicit boolean to
QuestionResponse.from(Question, boolean) (or to the new explicit-name method)
and delete the original one-arg from(Question) to eliminate the implicit
default.
src/test/java/com/jobdri/jobdri_api/domain/analysis/service/QuestionServiceTest.java (1)

129-131: ⚡ Quick win

Assert content-to-custom pairs instead of index-only flags.

These checks are order-coupled and don’t validate which question each flag belongs to. Asserting tuples (content, custom) will make regressions much clearer.

Suggested test assertion update
-        assertThat(response.questions()).hasSize(2);
-        assertThat(response.questions().get(0).custom()).isFalse();
-        assertThat(response.questions().get(1).custom()).isTrue();
+        assertThat(response.questions())
+                .extracting(q -> org.assertj.core.api.Assertions.tuple(q.content(), q.custom()))
+                .containsExactly(
+                        org.assertj.core.api.Assertions.tuple("지원 동기와 입사 후 목표를 작성해주세요.", false),
+                        org.assertj.core.api.Assertions.tuple("직접 추가한 문항입니다.", true)
+                );
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@src/test/java/com/jobdri/jobdri_api/domain/analysis/service/QuestionServiceTest.java`
around lines 129 - 131, In QuestionServiceTest, replace the index-coupled
assertions on response.questions() with tuple-based assertions that pair each
question's content and custom flag; e.g. use AssertJ's
extracting("content","custom") or map each question to a (content, custom) pair
and assert containsExactlyInAnyOrder(...) so the test verifies which content has
which custom value instead of relying on list order (locate where
response.questions() is asserted and update those assertions).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@src/main/java/com/jobdri/jobdri_api/domain/analysis/dto/response/QuestionResponse.java`:
- Around line 12-14: The one-arg factory method QuestionResponse.from(Question)
silently hardcodes custom=false; remove this overload so callers must call
QuestionResponse.from(Question, boolean) with an explicit custom value (or
alternatively rename the single-arg variant to something like
fromDefaultForTests to signal the hardcoded intent). Update all call sites that
used QuestionResponse.from(Question) to pass an explicit boolean to
QuestionResponse.from(Question, boolean) (or to the new explicit-name method)
and delete the original one-arg from(Question) to eliminate the implicit
default.

In
`@src/test/java/com/jobdri/jobdri_api/domain/analysis/service/QuestionServiceTest.java`:
- Around line 129-131: In QuestionServiceTest, replace the index-coupled
assertions on response.questions() with tuple-based assertions that pair each
question's content and custom flag; e.g. use AssertJ's
extracting("content","custom") or map each question to a (content, custom) pair
and assert containsExactlyInAnyOrder(...) so the test verifies which content has
which custom value instead of relying on list order (locate where
response.questions() is asserted and update those assertions).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 363894e8-8966-4c21-afd9-0e91fb5ac8f0

📥 Commits

Reviewing files that changed from the base of the PR and between e599bf0 and 655aa4a.

📒 Files selected for processing (3)
  • src/main/java/com/jobdri/jobdri_api/domain/analysis/dto/response/QuestionResponse.java
  • src/main/java/com/jobdri/jobdri_api/domain/analysis/service/QuestionService.java
  • src/test/java/com/jobdri/jobdri_api/domain/analysis/service/QuestionServiceTest.java

- QuestionResponse의 단일 인자 from 메서드 제거
- QuestionResponse 생성 시 custom 값을 명시적으로 전달하도록 정리
- 선택 문항 조회 테스트를 문항 내용과 custom 값 쌍으로 검증하도록 수정
- 리스트 순서에 의존하지 않도록 테스트 assertion 개선
@whc9999 whc9999 merged commit e1bf2cf into main May 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ feat New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant