-
Notifications
You must be signed in to change notification settings - Fork 40
Elasticsearch Integration for Beneficiary Search #122
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
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the β¨ 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 |
| * Runs sync jobs in background without blocking API calls | ||
| */ | ||
| @Service | ||
| public class AsyncElasticsearchSyncService { |
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.
The context of "Async" and "sync" of document to Elasticsearch are 2 different things.
Is ASync prefix necessary?
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.
For my reference, I kept for now. I will change once everything is completed.
src/main/java/com/iemr/common/identity/controller/IdentityESController.java
Fixed
Show fixed
Hide fixed
src/main/java/com/iemr/common/identity/controller/IdentityESController.java
Fixed
Show fixed
Hide fixed
src/main/java/com/iemr/common/identity/controller/IdentityESController.java
Fixed
Show fixed
Hide fixed
src/main/java/com/iemr/common/identity/controller/IdentityESController.java
Fixed
Show fixed
Hide fixed
src/main/java/com/iemr/common/identity/controller/IdentityESController.java
Fixed
Show fixed
Hide fixed
src/main/java/com/iemr/common/identity/controller/IdentityESController.java
Fixed
Show fixed
Hide fixed
src/main/java/com/iemr/common/identity/controller/IdentityESController.java
Fixed
Show fixed
Hide fixed
src/main/java/com/iemr/common/identity/controller/IdentityESController.java
Fixed
Show fixed
Hide fixed
src/main/java/com/iemr/common/identity/controller/IdentityESController.java
Fixed
Show fixed
Hide fixed
src/main/java/com/iemr/common/identity/service/elasticsearch/ElasticsearchService.java
Fixed
Show fixed
Hide fixed
| @PostMapping("/single/{benRegId}") | ||
| public ResponseEntity<Map<String, Object>> syncSingleBeneficiary( | ||
| @PathVariable String benRegId) { | ||
| logger.info("Received request to sync single beneficiary: {}", benRegId); |
Check notice
Code scanning / SonarCloud
Logging should not be vulnerable to injection attacks Low
| @GetMapping("/debug/check/{benRegId}") | ||
| public ResponseEntity<Map<String, Object>> checkBeneficiaryExists( | ||
| @PathVariable String benRegId) { | ||
| logger.info("Checking if beneficiary exists: {}", benRegId); |
Check notice
Code scanning / SonarCloud
Logging should not be vulnerable to injection attacks Low
src/main/java/com/iemr/common/identity/service/elasticsearch/ElasticsearchService.java
Fixed
Show fixed
Hide fixed
| public boolean syncSingleBeneficiary(String benRegId) { | ||
| try { | ||
| logger.info("========================================"); | ||
| logger.info("Syncing single beneficiary with BenRegId: {}", benRegId); |
Check notice
Code scanning / SonarCloud
Logging should not be vulnerable to injection attacks Low
| // Check if beneficiary exists in database first using transactional wrapper | ||
| boolean exists = transactionalWrapper.existsByBenRegId(benRegIdBig); | ||
| if (!exists) { | ||
| logger.error("Beneficiary does not exist in database: BenRegId={}", benRegId); |
Check notice
Code scanning / SonarCloud
Logging should not be vulnerable to injection attacks Low
| BeneficiariesDTO benDTO = beneficiaryDataService.getBeneficiaryFromDatabase(benRegIdBig); | ||
|
|
||
| if (benDTO == null) { | ||
| logger.error("Failed to fetch beneficiary details from database: BenRegId={}", benRegId); |
Check notice
Code scanning / SonarCloud
Logging should not be vulnerable to injection attacks Low
| BeneficiaryDocument doc = convertToDocument(benDTO); | ||
|
|
||
| if (doc == null || doc.getBenId() == null) { | ||
| logger.error("Failed to convert beneficiary to document: BenRegId={}", benRegId); |
Check notice
Code scanning / SonarCloud
Logging should not be vulnerable to injection attacks Low
|
|
||
| logger.info("========================================"); | ||
| logger.info("SUCCESS! Beneficiary synced to Elasticsearch"); | ||
| logger.info("BenRegId: {}, BenId: {}", benRegId, doc.getBenId()); |
Check notice
Code scanning / SonarCloud
Logging should not be vulnerable to injection attacks Low
| // Save job to database | ||
| job = syncJobRepository.save(job); | ||
|
|
||
| logger.info("Created new full sync job: jobId={}, triggeredBy={}", job.getJobId(), triggeredBy); |
Check notice
Code scanning / SonarCloud
Logging should not be vulnerable to injection attacks Low
| * Universal search with optional user location for ranking | ||
| */ | ||
| public List<Map<String, Object>> universalSearch(String query, Integer userId) { | ||
| logger.info("Universal ES search for: {} with userId: {}", query, userId); |
Check notice
Code scanning / SonarCloud
Logging should not be vulnerable to injection attacks Low
|
|
Track in PR #123 |




π Description
JIRA ID:
AMM-1951
β Type of Change