Skip to content

Conversation

@vanitha1822
Copy link
Contributor

πŸ“‹ Description

JIRA ID:

AMM-1951


βœ… Type of Change

  • ✨ New feature (non-breaking change which adds functionality)

@coderabbitai
Copy link

coderabbitai bot commented Dec 6, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
πŸ§ͺ Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch nd/vs/elastic_search_1951

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.

❀️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@vanitha1822 vanitha1822 requested a review from drtechie December 6, 2025 06:00
@vanitha1822 vanitha1822 marked this pull request as draft December 6, 2025 06:00
@vanitha1822 vanitha1822 self-assigned this Dec 6, 2025
* Runs sync jobs in background without blocking API calls
*/
@Service
public class AsyncElasticsearchSyncService {
Copy link
Member

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?

Copy link
Contributor Author

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.

@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

Change this code to not log user-controlled data. See more on SonarQube Cloud
@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

Change this code to not log user-controlled data. See more on SonarQube Cloud
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

Change this code to not log user-controlled data. See more on SonarQube Cloud
// 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

Change this code to not log user-controlled data. See more on SonarQube Cloud
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

Change this code to not log user-controlled data. See more on SonarQube Cloud
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

Change this code to not log user-controlled data. See more on SonarQube Cloud

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

Change this code to not log user-controlled data. See more on SonarQube Cloud
// 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

Change this code to not log user-controlled data. See more on SonarQube Cloud
* 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

Change this code to not log user-controlled data. See more on SonarQube Cloud
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
5.0% Duplication on New Code (required ≀ 3%)
C Reliability Rating on New Code (required β‰₯ A)
E Security Rating on New Code (required β‰₯ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@vanitha1822
Copy link
Contributor Author

Track in PR #123

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants