-
Notifications
You must be signed in to change notification settings - Fork 0
[Feat] Add job posting sequence analysis lookup (#27) #89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...n/java/com/jobdri/jobdri_api/domain/analysis/controller/JobPostingAnalysisController.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| package com.jobdri.jobdri_api.domain.analysis.controller; | ||
|
|
||
| import com.jobdri.jobdri_api.domain.analysis.dto.response.AnalysisResponse; | ||
| import com.jobdri.jobdri_api.domain.analysis.service.AnalysisService; | ||
| import com.jobdri.jobdri_api.global.apiPayload.ApiResponse; | ||
| import com.jobdri.jobdri_api.global.apiPayload.code.GeneralErrorCode; | ||
| import com.jobdri.jobdri_api.global.apiPayload.exception.GeneralException; | ||
| import com.jobdri.jobdri_api.global.security.UserDetailsImpl; | ||
| import io.swagger.v3.oas.annotations.Operation; | ||
| import io.swagger.v3.oas.annotations.tags.Tag; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.security.core.annotation.AuthenticationPrincipal; | ||
| import org.springframework.web.bind.annotation.GetMapping; | ||
| import org.springframework.web.bind.annotation.PathVariable; | ||
| import org.springframework.web.bind.annotation.RequestMapping; | ||
| import org.springframework.web.bind.annotation.RequestParam; | ||
| import org.springframework.web.bind.annotation.RestController; | ||
|
|
||
| @RestController | ||
| @RequiredArgsConstructor | ||
| @RequestMapping("/api/job-postings/{jobPostingId}/analysis") | ||
| @Tag(name = "Analysis", description = "자소서 분석 API") | ||
| public class JobPostingAnalysisController { | ||
|
|
||
| private final AnalysisService analysisService; | ||
|
|
||
| @Operation(summary = "지원 회차별 자소서 분석 결과 조회", description = "공고 기준으로 지정한 지원 회차의 자소서 분석 결과를 조회합니다.") | ||
| @GetMapping | ||
| public ApiResponse<AnalysisResponse> getAnalysisBySequence( | ||
| @AuthenticationPrincipal UserDetailsImpl userDetails, | ||
| @PathVariable Long jobPostingId, | ||
| @RequestParam Integer sequence | ||
| ) { | ||
| return ApiResponse.onSuccess( | ||
| "자소서 분석 결과 조회에 성공했습니다.", | ||
| analysisService.getAnalysisByJobPostingSequence(getAuthenticatedUser(userDetails), jobPostingId, sequence) | ||
| ); | ||
| } | ||
|
|
||
| private com.jobdri.jobdri_api.domain.user.entity.User getAuthenticatedUser(UserDetailsImpl userDetails) { | ||
| if (userDetails == null || userDetails.getUser() == null) { | ||
| throw new GeneralException(GeneralErrorCode.MISSING_AUTH_INFO, "인증 정보가 누락되었습니다."); | ||
| } | ||
| return userDetails.getUser(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
In Spring MVC, if a controller method uses@GetMappingand does not declare@RequestParam("sequence"), does a request to the same path with?sequence=2still match and ignore the extra query parameter by default? Also, does@GetMapping(params = "!sequence")prevent that request from matching?💡 Result:
Yes: by default, if a controller method is mapped only with
@GetMapping(matching by path and HTTP method) and it does NOT declare any request-parameter conditions via@RequestMapping(params=...) /@GetMapping(params=...), then an extra query parameter like?sequence=2 does not prevent the request from matching. Spring will still route to the handler method;@RequestParamaffects only whether you can bind a specific parameter into a method argument, not whether unmapped extra query parameters block request mapping. [1][2] No:@GetMapping(params = "!sequence") does not “ignore”?sequence=2; instead it adds a request-mapping condition that requires the parameter sequence to be absent. Spring’s request-mapping “params” condition supports negation with the! form ("!myParam" means the specified parameter is not supposed to be present in the request). Therefore, a request to the same path with sequence=2 will NOT match a mapping declared with params="!sequence". [1][3][4] Example outcomes: -@GetMapping(path="/x") with no params condition: /x?sequence=2 still matches. -@GetMapping(path="/x", params="!sequence"): /x?sequence=2 does not match; only /x with no sequence parameter matches.Citations:
🏁 Script executed:
Repository: JobDri-Developer/BackEnd
Length of output: 276
🏁 Script executed:
Repository: JobDri-Developer/BackEnd
Length of output: 5211
Reject legacy
sequencequery param on/api/mock-applies/{mockApplyId}/analysisGET to avoid silent wrong resultsAnalysisController#getAnalysismapsGET /api/mock-applies/{mockApplyId}/analysiswith@GetMappingbut does not declare asequencerequest parameter (no@RequestParam("sequence")and noparamscondition). A request to/api/mock-applies/{mockApplyId}/analysis?sequence=Nwill still match this handler, andsequencewill be ignored, returning results based only onmockApplyId—silently breaking the expected “sequence-based” behavior clients may be using.exists in
JobPostingAnalysisController, so fail fast on the legacy route by rejecting requests that includesequence.🧭 Minimal guard to fail fast on legacy `sequence` calls
🤖 Prompt for AI Agents