[Fix] 재지원 공고 연결 기준 수정#90
Conversation
- 재지원 시 새 JobPosting을 복제 생성하지 않고 원본 공고에 새 MockApply만 생성 - MockApply sequence 자동 할당 기준을 user + jobPostingId로 변경 - 같은 회사/직무의 다른 공고는 각각 독립된 sequence를 갖도록 테스트 수정 - 재지원 시 같은 jobPostingId 안에서 sequence가 증가하는지 검증
|
Caution Review failedFailed to post review comments 📝 WalkthroughWalkthroughRe-keys mock-apply sequence allocation from (companyId, detailClassificationId) to jobPostingId: update entity constraint, repository queries, sequence allocation service and MockApplyService retry flow, adjust tests, and remove a trailing suffix from the retry endpoint OpenAPI summary. ChangesMockApply Sequence Allocation Refactoring
Sequence DiagramsequenceDiagram
participant Client
participant MockApplyService
participant MockApplySequenceService
participant MockApplySequenceRepository
participant MockApplyRepository
participant Database
Client->>MockApplyService: retryMockApply(request)
MockApplyService->>MockApplySequenceService: allocate(userId, jobPostingId)
MockApplySequenceService->>MockApplySequenceRepository: findByKeyForUpdate(userId, jobPostingId)
MockApplySequenceRepository->>Database: SELECT ... FOR UPDATE (mas where userId & jobPostingId)
MockApplySequenceService->>MockApplyRepository: findMaxSequenceByUserIdAndJobPostingId(userId, jobPostingId)
MockApplyRepository->>Database: SELECT coalesce(max(sequence),0) FROM mock_apply WHERE user_id=? AND job_posting_id=?
MockApplyService->>MockApplyRepository: saveMockApplyWithSequence(mockApply with allocated sequence)
MockApplyRepository->>Database: INSERT/UPDATE mock_apply / mock_apply_sequence rows
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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.
Inline comments:
In
`@src/main/java/com/jobdri/jobdri_api/domain/mockapply/controller/MockApplyController.java`:
- Line 203: Update the OpenAPI description string in MockApplyController (the
description used in the `@Operation` annotation for the retry endpoint) to reflect
that the new retry creates a new MockApply linked to the original JobPosting
rather than copying the posting and selection questions; change wording from
"복사" (copy) to indicate "재사용" or "원본 공고와 연동" and that answers are cleared so the
applicant restarts from the essay input step.
In
`@src/main/java/com/jobdri/jobdri_api/domain/mockapply/service/MockApplyService.java`:
- Around line 259-262: The current max+1 allocation in MockApplyService (using
mockApplyRepository.findMaxSequenceByUserIdAndJobPostingId) races under
concurrent creates for the same (user, jobPosting); replace it with a
serialized, DB-backed counter or lock: create or use a dedicated counter row
keyed by (userId, jobPostingId) and SELECT ... FOR UPDATE (or a JPA/Pessimistic
WRITE lock) to increment and return the next sequence inside the same
transaction, or alternatively use a database sequence/atomic counter scoped to
that key; ensure the allocation logic in MockApplyService obtains the
lock/counter, increments it in-transaction, and then uses that value for the new
mock apply instead of computing max+1.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 6712b845-5d9c-46a7-aad9-2d24665bc10c
📒 Files selected for processing (4)
src/main/java/com/jobdri/jobdri_api/domain/mockapply/controller/MockApplyController.javasrc/main/java/com/jobdri/jobdri_api/domain/mockapply/repository/MockApplyRepository.javasrc/main/java/com/jobdri/jobdri_api/domain/mockapply/service/MockApplyService.javasrc/test/java/com/jobdri/jobdri_api/domain/mockapply/service/MockApplyServiceTest.java
| @Operation( | ||
| summary = "모의 서류 지원 재도전 - ", | ||
| summary = "모의 서류 지원 재도전", | ||
| description = "기존 모의 서류 지원의 공고와 선택 문항을 복사해 새 회차의 모의 서류 지원을 생성합니다. 답변은 비워진 상태로 자소서 입력 단계부터 다시 진행합니다." |
There was a problem hiding this comment.
OpenAPI description is stale vs new retry behavior.
Line 203 still says the retry flow “copies” the posting, but this PR’s behavior is to create a new MockApply linked to the original JobPosting. Please update the description text to reflect reuse of the original posting.
🤖 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/mockapply/controller/MockApplyController.java`
at line 203, Update the OpenAPI description string in MockApplyController (the
description used in the `@Operation` annotation for the retry endpoint) to reflect
that the new retry creates a new MockApply linked to the original JobPosting
rather than copying the posting and selection questions; change wording from
"복사" (copy) to indicate "재사용" or "원본 공고와 연동" and that answers are cleared so the
applicant restarts from the essay input step.
- MockApplySequence 키를 userId + jobPostingId 기준으로 변경 - sequence 할당 시 PESSIMISTIC_WRITE 락으로 카운터 row 직렬화 - MockApplyService의 max+1 직접 계산 제거 - 카운터 생성 충돌 시 재시도 후 GeneralException으로 매핑 - 재지원 시 같은 공고 내 sequence가 안정적으로 증가하도록 보완
✨ 어떤 이유로 PR를 하셨나요?
📋 세부 내용 - 왜 해당 PR이 필요한지 작업 내용을 자세하게 설명해주세요
📸 작업 화면 스크린샷
🚨 관련 이슈 번호 [#38 ]
Summary by CodeRabbit
Bug Fixes
Refactor
Tests
Documentation