[Fix] 모의 지원 단건 삭제 로직 추가#129
Conversation
DELETE /api/mock-applies/{mockApplyId} 추가
모의 지원 단건 기준으로 QuestionAnalysis -> Analysis -> Question -> MockApply 순서 삭제
같은 공고에 연결된 다른 모의 지원/문항/분석은 유지
다른 사용자의 모의 지원 삭제 시 FORBIDDEN 유지
단건 삭제 회귀 테스트 추가
|
Warning Review limit reached
Next review available in: 52 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds mock-application deletion through repository bulk-delete queries, transactional service orchestration, a secured HTTP DELETE endpoint, and tests for cascading data removal and ownership enforcement. ChangesMock application deletion
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/main/java/com/jobdri/jobdri_api/domain/mockapply/controller/MockApplyController.java (1)
53-57: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider adding
@ApiResponsesdocumentation.Other endpoints in this controller document their success and standard HTTP error codes (401, 403, 404) via
@ApiResponses. Adding them here would maintain Swagger documentation consistency.📝 Proposed OpenAPI annotations
`@Operation`( summary = "모의 서류 지원 단건 삭제", description = "mockApplyId에 해당하는 모의 서류 지원과 연결된 문항, 분석 결과만 삭제합니다. 같은 공고의 다른 모의 지원은 유지됩니다." ) + `@ApiResponses`(value = { + `@io.swagger.v3.oas.annotations.responses.ApiResponse`( + responseCode = "200", + description = "모의 서류 지원 단건 삭제 성공" + ), + `@io.swagger.v3.oas.annotations.responses.ApiResponse`( + responseCode = "401", + description = "인증 정보 누락" + ), + `@io.swagger.v3.oas.annotations.responses.ApiResponse`( + responseCode = "403", + description = "다른 사용자의 모의 서류 지원 접근 시도" + ), + `@io.swagger.v3.oas.annotations.responses.ApiResponse`( + responseCode = "404", + description = "해당 모의 서류 지원 없음" + ) + }) `@DeleteMapping`("/{mockApplyId}")🤖 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` around lines 53 - 57, Update the delete endpoint method associated with `@DeleteMapping`("/{mockApplyId}") in MockApplyController by adding `@ApiResponses` documentation for the successful deletion response and standard 401, 403, and 404 error responses, matching the annotation style used by the other controller endpoints.src/main/java/com/jobdri/jobdri_api/domain/analysis/repository/QuestionAnalysisRepository.java (1)
17-24: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valuePrefer explicit subqueries over implicit joins in JPQL
DELETE.Traversing multiple relationship levels (e.g.,
qa.analysis.mockApply.id) in a JPQLDELETEquery relies on the JPA provider (Hibernate 6) to dynamically generate subqueries, as standard SQL/JPA does not support joins inDELETEstatements.To ensure safety and maintain consistency with the explicit subquery pattern already used in
deleteAllByJobPostingId(lines 28-32), consider rewriting this query with explicit subqueries.♻️ Proposed refactor
`@Modifying`(clearAutomatically = true, flushAutomatically = true) `@Query`(""" delete from QuestionAnalysis qa - where qa.analysis.mockApply.id = :mockApplyId - or qa.question.mockApply.id = :mockApplyId + where qa.analysis.id in ( + select a.id + from Analysis a + where a.mockApply.id = :mockApplyId + ) + or qa.question.id in ( + select q.id + from Question q + where q.mockApply.id = :mockApplyId + ) """) void deleteAllByMockApplyId(`@Param`("mockApplyId") Long mockApplyId);🤖 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/repository/QuestionAnalysisRepository.java` around lines 17 - 24, Rewrite deleteAllByMockApplyId to replace the relationship traversals in its JPQL DELETE predicate with explicit subqueries, matching the established pattern used by deleteAllByJobPostingId. Preserve both deletion conditions through analysis and question while binding mockApplyId consistently.
🤖 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/repository/QuestionAnalysisRepository.java`:
- Around line 17-24: Rewrite deleteAllByMockApplyId to replace the relationship
traversals in its JPQL DELETE predicate with explicit subqueries, matching the
established pattern used by deleteAllByJobPostingId. Preserve both deletion
conditions through analysis and question while binding mockApplyId consistently.
In
`@src/main/java/com/jobdri/jobdri_api/domain/mockapply/controller/MockApplyController.java`:
- Around line 53-57: Update the delete endpoint method associated with
`@DeleteMapping`("/{mockApplyId}") in MockApplyController by adding `@ApiResponses`
documentation for the successful deletion response and standard 401, 403, and
404 error responses, matching the annotation style used by the other controller
endpoints.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: a7fc7b4f-8b92-4d5b-bf85-da497db12bf2
📒 Files selected for processing (6)
src/main/java/com/jobdri/jobdri_api/domain/analysis/repository/AnalysisRepository.javasrc/main/java/com/jobdri/jobdri_api/domain/analysis/repository/QuestionAnalysisRepository.javasrc/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
QuestionAnalysisRepository.deleteAllByMockApplyId의 JPQL DELETE 조건을 관계 직접 탐색 대신 Analysis, Question 명시 subquery 방식으로 변경
MockApplyController의 DELETE /api/mock-applies/{mockApplyId}에 200, 401, 403, 404 @ApiResponses 문서 추가
✨ 어떤 이유로 PR를 하셨나요?
📋 세부 내용 - 왜 해당 PR이 필요한지 작업 내용을 자세하게 설명해주세요
📸 작업 화면 스크린샷
🚨 관련 이슈 번호 [ ]
Summary by CodeRabbit
New Features
Bug Fixes
Tests