fix(MAJORLEA-001): 3 review findings in HiringController.java - #72
fix(MAJORLEA-001): 3 review findings in HiringController.java#72flamingo[bot] wants to merge 1 commit into
Conversation
| @@ -18,19 +20,23 @@ | |||
| public class HiringController { | |||
|
|
|||
| private final HiringService hiringService; | |||
There was a problem hiding this comment.
🦩 🔴 HiringController.getHiringManagerProfile() returns raw Map instead of ApiResponse envelope
In getHiringManagerProfile(): changed return type from Map<String, Object> to ResponseEntity<ApiResponse<Map<String, Object>>>, added cacheService.isCacheReady() guard returning ApiResponse.error(...) when not ready, and wrapped the service result with ApiResponse.success(...). Added imports for ResponseEntity, ApiResponse, and CacheService. Added cacheService field. Risk: assumes ApiResponse class exists at cx.flamingo.analysis.model.ApiResponse with success(String, T) and error(String) static factory methods — reviewer should verify the exact package and method signatures match the codebase.
🤖 Prompt for AI agents
In backend/src/main/java/cx/flamingo/analysis/controller/HiringController.java around line 20, review and complete this code-review fix: HiringController.getHiringManagerProfile() returns raw Map instead of ApiResponse<T> envelope.
What the draft fix changed: In `getHiringManagerProfile()`: changed return type from `Map<String, Object>` to `ResponseEntity<ApiResponse<Map<String, Object>>>`, added `cacheService.isCacheReady()` guard returning `ApiResponse.error(...)` when not ready, and wrapped the service result with `ApiResponse.success(...)`. Added imports for `ResponseEntity`, `ApiResponse`, and `CacheService`. Added `cacheService` field. Risk: assumes `ApiResponse` class exists at `cx.flamingo.analysis.model.ApiResponse` with `success(String, T)` and `error(String)` static factory methods — reviewer should verify the exact package and method signatures match the codebase.
Verify the change is correct and complete; do not refactor unrelated code.
fix confidence: 🟡 82 medium — react 👍/👎 to teach the reviewer
|
|
||
| @GetMapping("/jobs") | ||
| public Map<String, Object> getJobOpenings() { | ||
| Map<String, Object> response = new HashMap<>(); |
There was a problem hiding this comment.
🦩 🔴 HiringController.getJobOpenings() manually constructs envelope map instead of using ApiResponse factory methods
In getJobOpenings(): replaced manual HashMap envelope construction (response.put("status", "success") etc.) with ResponseEntity<ApiResponse<List<JobOpening>>> return type using ApiResponse.success("Job openings retrieved successfully", jobs). Removed now-unused HashMap import. Same risk as finding 1 regarding ApiResponse factory method signatures.
🤖 Prompt for AI agents
In backend/src/main/java/cx/flamingo/analysis/controller/HiringController.java around line 29, review and complete this code-review fix: HiringController.getJobOpenings() manually constructs envelope map instead of using ApiResponse factory methods.
What the draft fix changed: In `getJobOpenings()`: replaced manual `HashMap` envelope construction (`response.put("status", "success")` etc.) with `ResponseEntity<ApiResponse<List<JobOpening>>>` return type using `ApiResponse.success("Job openings retrieved successfully", jobs)`. Removed now-unused `HashMap` import. Same risk as finding 1 regarding `ApiResponse` factory method signatures.
Verify the change is correct and complete; do not refactor unrelated code.
fix confidence: 🟡 82 medium — react 👍/👎 to teach the reviewer
| @@ -18,19 +20,23 @@ | |||
| public class HiringController { | |||
|
|
|||
| private final HiringService hiringService; | |||
There was a problem hiding this comment.
🦩 🔴 HiringController endpoints do not guard with cacheService.isCacheReady()
Added cacheService.isCacheReady() guard as the first action in both getHiringManagerProfile() and getJobOpenings(), returning ApiResponse.error(...) immediately when cache is not ready. Risk: assumes CacheService is injectable via @RequiredArgsConstructor (i.e., it is a Spring bean) and that isCacheReady() is the correct method name — reviewer should verify CacheService exists at cx.flamingo.analysis.service.CacheService with that exact method. Also, whether HiringService data truly depends on the cache is assumed per the finding; if getJobOpenings() reads static data (e.g., a config file), the cache guard may be unnecessary for that endpoint.
🤖 Prompt for AI agents
In backend/src/main/java/cx/flamingo/analysis/controller/HiringController.java around line 20, review and complete this code-review fix: HiringController endpoints do not guard with cacheService.isCacheReady().
What the draft fix changed: Added `cacheService.isCacheReady()` guard as the first action in both `getHiringManagerProfile()` and `getJobOpenings()`, returning `ApiResponse.error(...)` immediately when cache is not ready. Risk: assumes `CacheService` is injectable via `@RequiredArgsConstructor` (i.e., it is a Spring bean) and that `isCacheReady()` is the correct method name — reviewer should verify `CacheService` exists at `cx.flamingo.analysis.service.CacheService` with that exact method. Also, whether `HiringService` data truly depends on the cache is assumed per the finding; if `getJobOpenings()` reads static data (e.g., a config file), the cache guard may be unnecessary for that endpoint.
Verify the change is correct and complete; do not refactor unrelated code.
fix confidence: 🟡 75 medium — react 👍/👎 to teach the reviewer
Closes 3 review findings in
backend/src/main/java/cx/flamingo/analysis/controller/HiringController.java.Draft — this is a starting point, not a finished change. The fix required judgment, so read it before trusting it.
backend/src/main/java/cx/flamingo/analysis/controller/HiringController.java:20backend/src/main/java/cx/flamingo/analysis/controller/HiringController.java:29backend/src/main/java/cx/flamingo/analysis/controller/HiringController.java:20What changed — and what was deliberately left — is explained per finding as inline review comments on the lines each finding touched.
Run: https://product-hub.flamingo.so/admin/code-review
Run id:
8f1c6ef6-6b61-4dcd-bb0e-59bc6a7d37e8Merging this PR is recorded as acceptance of the rule that produced it;
closing it unmerged is recorded as rejection. Both feed rule health, so
closing a wrong suggestion is useful rather than merely tidy.