Skip to content

Feature/incentive for supporting doc#108

Merged
SauravBizbRolly merged 6 commits intoPSMRI:sm/release-3.10.0_tempfrom
toarunmishra:feature/incentive_for_supporting_doc
Dec 15, 2025
Merged

Feature/incentive for supporting doc#108
SauravBizbRolly merged 6 commits intoPSMRI:sm/release-3.10.0_tempfrom
toarunmishra:feature/incentive_for_supporting_doc

Conversation

@SauravBizbRolly
Copy link
Copy Markdown
Collaborator

@SauravBizbRolly SauravBizbRolly commented Dec 9, 2025

📋 Description

JIRA ID: AMM-1994

In incentive screen option to attach activity missing supporting documents.


✅ Type of Change

  • 🐞 Bug fix (non-breaking change which resolves an issue)
  • New feature (non-breaking change which adds functionality)
  • 🔥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 🛠 Refactor (change that is neither a fix nor a new feature)
  • ⚙️ Config change (configuration file or build script updates)
  • 📚 Documentation (updates to docs or readme)
  • 🧪 Tests (adding new or updating existing tests)
  • 🎨 UI/UX (changes that affect the user interface)
  • 🚀 Performance (improves performance)
  • 🧹 Chore (miscellaneous changes that don't modify src or test files)

ℹ️ Additional Information

Please describe how the changes were tested, and include any relevant screenshots, logs, or other information that provides additional context.

Summary by CodeRabbit

  • Chores

    • Downgraded application version from 3.10.0 to 3.7.0.
    • Disabled Swagger/OpenAPI documentation across all environments.
  • New Features

    • Added update endpoint for MAA meetings with image support.
    • Added update endpoint for incentive activities.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Dec 9, 2025

Walkthrough

The pull request downgrades the Maven version and disables Swagger/OpenAPI endpoints across environment configurations. It introduces new incentive update functionality through a PendingActivity workflow, adding corresponding entities, DTOs, repositories, and service methods that support updating meetings when triggered via incentive updates with image handling.

Changes

Cohort / File(s) Change Summary
Version & Build Configuration
pom.xml
Maven artifact version downgraded from 3.10.0 to 3.7.0
Swagger/OpenAPI Disabling
src/main/environment/common_ci.properties, src/main/environment/common_docker.properties, src/main/resources/application.properties
Removed or disabled springdoc.api-docs.enabled and springdoc.swagger-ui.enabled properties across CI, Docker, and standard application configurations
Entity Layer
src/main/java/com/iemr/flw/domain/iemr/IncentiveActivityRecord.java, src/main/java/com/iemr/flw/domain/iemr/IncentivePendingActivity.java
Added isEligible and isDefaultActivity fields to IncentiveActivityRecord; introduced new IncentivePendingActivity entity with JPA mappings for id, activityId, recordId, moduleName, userId, createdDate, and updatedDate
DTO Layer
src/main/java/com/iemr/flw/dto/iemr/PendingActivityDTO.java, src/main/java/com/iemr/flw/dto/iemr/MaaMeetingRequestDTO.java
Created new PendingActivityDTO with id, userId, Images, and moduleName fields; added id field to MaaMeetingRequestDTO
Repository Layer
src/main/java/com/iemr/flw/repo/iemr/IncentivePendingActivityRepository.java
Introduced new JPA repository with findByUserIdAndModuleNameActivityId query method
Service Interfaces
src/main/java/com/iemr/flw/service/IncentiveService.java, src/main/java/com/iemr/flw/service/MaaMeetingService.java
Added updateIncentive(PendingActivityDTO) to IncentiveService; added updateMeeting(MaaMeetingRequestDTO) to MaaMeetingService
Service Implementations
src/main/java/com/iemr/flw/service/impl/IncentiveServiceImpl.java
Implemented updateIncentive with PendingActivity lookup, module-conditional logic for MAA_MEETING updates, image-to-base64 conversion, and error handling; wired IncentivePendingActivityRepository and MaaMeetingService dependencies
Controllers
src/main/java/com/iemr/flw/controller/IncentiveController.java, src/main/java/com/iemr/flw/controller/MaaMeetingController.java
Added POST /incentive/update endpoint to IncentiveController; added POST /update endpoint to MaaMeetingController with multipart form-data support; enhanced response handling and error logging on existing endpoints

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant IncentiveController
    participant IncentiveService
    participant IncentivePendingActivityRepo
    participant MaaMeetingService
    participant Database

    Client->>IncentiveController: POST /incentive/update<br/>(PendingActivityDTO)
    IncentiveController->>IncentiveService: updateIncentive(pendingActivityDTO)
    IncentiveService->>IncentivePendingActivityRepo: findByUserIdAndModuleNameActivityId<br/>(userId, moduleName, activityId)
    IncentivePendingActivityRepo->>Database: Query incentive_pending_activity
    Database-->>IncentivePendingActivityRepo: IncentivePendingActivity record
    IncentivePendingActivityRepo-->>IncentiveService: Optional<IncentivePendingActivity>
    
    alt Module is MAA_MEETING & Images exist
        IncentiveService->>IncentiveService: Convert Images to Base64
        IncentiveService->>MaaMeetingService: updateMeeting(MaaMeetingRequestDTO)
        MaaMeetingService->>Database: Fetch existing MaaMeeting by id
        Database-->>MaaMeetingService: MaaMeeting entity
        MaaMeetingService->>Database: Update MaaMeeting with new data
        Database-->>MaaMeetingService: Success
        MaaMeetingService-->>IncentiveService: Updated MaaMeeting
    else Error
        IncentiveService-->>IncentiveService: Catch exception & store message
    end
    
    IncentiveService-->>IncentiveController: Error message or null
    IncentiveController-->>Client: Response (200 OK or error)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • IncentiveServiceImpl.java: Review the complex updateIncentive logic carefully, particularly the conditional module handling and image conversion flow to MaaMeetingService; verify error handling and null-checks
  • Service layer coordination: Ensure proper wiring and interaction between IncentiveService, IncentivePendingActivityRepository, and MaaMeetingService
  • DTO and entity mappings: Confirm that new fields (isEligible, isDefaultActivity) and the IncentivePendingActivity entity align with database schema
  • Version downgrade impact: Assess implications of the Maven version change from 3.10.0 to 3.7.0 for compatibility and dependencies
  • Swagger disabling: Verify intentionality of disabling API documentation endpoints across all environments

Poem

🐰 A hop, skip, and jump through the code we go,
Incentives now update with a graceful flow,
With images converted to base64 light,
Pending activities dance, day and night!
Version takes a backward spin,
But forward logic wins within. 🎉

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title is vague and generic, using non-descriptive phrasing ('Feature/incentive for supporting doc') that lacks clarity about the specific changes. Revise the title to be more specific and descriptive, e.g., 'Add support for uploading missing supporting documents in incentive workflow' or similar, to clearly communicate the primary change.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@SauravBizbRolly
Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Dec 9, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (7)
src/main/environment/common_docker.properties (1)

18-19: Consistent Swagger disabling across environments.

Removal of Swagger properties aligns with the pattern in other environment configs. The system will now rely on defaults from application.properties (where Swagger is explicitly disabled). Minor: Using a single blank line per removed property may be more idiomatic, but this is not a functional issue.

src/main/java/com/iemr/flw/domain/iemr/IncentiveActivityRecord.java (1)

50-54: Align DB schema with new eligibility/default flags

The new is_eligible and is_default_activity columns on incentive_activity_record look fine, but make sure the database migration adds these columns with the expected nullability/defaults so JPA mapping and existing records don’t break.

src/main/java/com/iemr/flw/controller/MaaMeetingController.java (1)

36-60: Redundant dto != null check in saveMeeting

dto is always non-null because it is instantiated just above, so:

if (dto != null) {
    service.saveMeeting(dto);
}

can be simplified to a direct service.saveMeeting(dto); call inside the try block.

src/main/java/com/iemr/flw/service/impl/IncentiveServiceImpl.java (2)

203-203: Extract hardcoded module name to a constant.

The string "MAA_MEETING" should be extracted to a constant (or use an enum) to avoid typos and improve maintainability, similar to how GroupName enum is used elsewhere in this codebase.

+private static final String MODULE_MAA_MEETING = "MAA_MEETING";
+
 // In updateIncentive method:
-if(existingIncentivePendingActivity.getModuleName().equals("MAA_MEETING")){
+if(existingIncentivePendingActivity.getModuleName().equals(MODULE_MAA_MEETING)){

197-219: Clarify return value semantics for better API design.

The method returns null in three different scenarios:

  1. Pending activity not found (line 217)
  2. Module name doesn't match "MAA_MEETING" (line 217)
  3. Success (implicitly, after update completes)

Consider returning distinct values or throwing appropriate exceptions to help callers distinguish between "success", "not found", and "not applicable" states.

src/main/java/com/iemr/flw/domain/iemr/IncentivePendingActivity.java (2)

34-38: Use java.sql.Timestamp for date fields to maintain consistency.

This entity uses java.util.Date for createdDate and updatedDate, but other entities in the codebase (e.g., IncentiveActivityRecord, OrsDistribution) use java.sql.Timestamp. Consider using Timestamp for consistency and better precision.

-import java.util.Date;
+import java.sql.Timestamp;

 @Column(name = "created_date")
-private Date createdDate;
+private Timestamp createdDate;
 
 @Column(name = "updated_date")
-private Date updatedDate;
+private Timestamp updatedDate;

15-39: Consider adding audit fields for traceability.

Other related entities like IncentiveActivityRecord include createdBy and updatedBy fields. Adding these would improve traceability of who created/modified pending activity records.

Additionally, consider adding @PrePersist and @PreUpdate callbacks to auto-populate the date fields:

+@Column(name = "created_by")
+private String createdBy;
+
+@Column(name = "updated_by")
+private String updatedBy;
+
+@PrePersist
+protected void onCreate() {
+    createdDate = new Timestamp(System.currentTimeMillis());
+}
+
+@PreUpdate
+protected void onUpdate() {
+    updatedDate = new Timestamp(System.currentTimeMillis());
+}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c6bfcc8 and 09ad416.

📒 Files selected for processing (14)
  • pom.xml (1 hunks)
  • src/main/environment/common_ci.properties (1 hunks)
  • src/main/environment/common_docker.properties (1 hunks)
  • src/main/java/com/iemr/flw/controller/IncentiveController.java (6 hunks)
  • src/main/java/com/iemr/flw/controller/MaaMeetingController.java (1 hunks)
  • src/main/java/com/iemr/flw/domain/iemr/IncentiveActivityRecord.java (1 hunks)
  • src/main/java/com/iemr/flw/domain/iemr/IncentivePendingActivity.java (1 hunks)
  • src/main/java/com/iemr/flw/dto/iemr/MaaMeetingRequestDTO.java (1 hunks)
  • src/main/java/com/iemr/flw/dto/iemr/PendingActivityDTO.java (1 hunks)
  • src/main/java/com/iemr/flw/repo/iemr/IncentivePendingActivityRepository.java (1 hunks)
  • src/main/java/com/iemr/flw/service/IncentiveService.java (2 hunks)
  • src/main/java/com/iemr/flw/service/MaaMeetingService.java (5 hunks)
  • src/main/java/com/iemr/flw/service/impl/IncentiveServiceImpl.java (3 hunks)
  • src/main/resources/application.properties (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (4)
src/main/java/com/iemr/flw/dto/iemr/PendingActivityDTO.java (1)
src/main/java/com/iemr/flw/dto/iemr/MaaMeetingRequestDTO.java (1)
  • Data (9-18)
src/main/java/com/iemr/flw/service/MaaMeetingService.java (1)
src/main/java/com/iemr/flw/service/impl/IncentiveServiceImpl.java (1)
  • Service (33-271)
src/main/java/com/iemr/flw/service/impl/IncentiveServiceImpl.java (1)
src/main/java/com/iemr/flw/service/MaaMeetingService.java (1)
  • Service (22-231)
src/main/java/com/iemr/flw/domain/iemr/IncentivePendingActivity.java (4)
src/main/java/com/iemr/flw/dto/iemr/MaaMeetingRequestDTO.java (1)
  • Data (9-18)
src/main/java/com/iemr/flw/dto/iemr/PendingActivityDTO.java (1)
  • Data (8-14)
src/main/java/com/iemr/flw/domain/iemr/IncentiveActivityRecord.java (1)
  • Entity (8-55)
src/main/java/com/iemr/flw/domain/iemr/OrsDistribution.java (1)
  • Table (9-42)
🔇 Additional comments (14)
src/main/environment/common_ci.properties (1)

19-19: Consistent with broader Swagger disabling pattern.

This change aligns with the Swagger disabling pattern in application.properties and common_docker.properties. However, the business rationale for disabling API documentation across all environments remains unclear (see the comment on application.properties lines 66–67 for context).

pom.xml (1)

9-9: Confirm version 3.7.0 matches the target branch intent.

Line 9 sets the version to 3.7.0, which appears inconsistent with the target branch name sm/release-3.10.0_temp. Verify whether this version is intentional for this release or if it should align with the 3.10.0 branch context.

src/main/resources/application.properties (1)

66-67: Clarify the rationale for disabling API documentation.

Lines 66–67 disable SpringDoc API docs and Swagger UI generation. If this change accompanies new endpoint additions, it creates potential gaps in API reference material. Clarify whether this is a temporary security measure, a configuration oversight, a permanent choice, or environment-specific (e.g., production-only). If permanent, confirm that alternative documentation is in place.

src/main/java/com/iemr/flw/dto/iemr/MaaMeetingRequestDTO.java (1)

9-18: id field addition is consistent with update requirements

Adding id to MaaMeetingRequestDTO is appropriate for update flows and aligns with MaaMeetingService.updateMeeting usage.

src/main/java/com/iemr/flw/service/IncentiveService.java (1)

6-19: Interface extension for PendingActivity-based updates looks consistent

Adding updateIncentive(PendingActivityDTO pendingActivityDTO) cleanly exposes the new workflow and matches the controller usage.

src/main/java/com/iemr/flw/controller/IncentiveController.java (2)

81-104: Enhanced error handling in getAllIncentivesByUserId looks good

Wrapping getAllIncentivesByUserId in a try/catch with null checks and logging, and using OutputResponse consistently, improves robustness without changing the contract.


106-127: Due to inability to access the repository, I cannot fully verify the specific claims about the class-level configuration or the exact type of the Images field in PendingActivityDTO. The technical concern about binding MultipartFile from JSON is architecturally sound, but definitive verification of the implementation details is not possible at this time.

src/main/java/com/iemr/flw/service/MaaMeetingService.java (2)

165-176: updateIncentive incorrectly creates a new record instead of updating the existing one

In updateIncentive, the code finds an existing record but then immediately discards it and creates a new instance:

IncentiveActivityRecord record = recordRepo
        .findRecordByActivityIdCreatedDateBenId(...);

if (record != null) {
    record = new IncentiveActivityRecord();
    record.setIsEligible(true);
    recordRepo.save(record);
}

This creates corrupt/invalid rows with unset fields and loses the linkage to the original activity/date/asha. Update the existing record instead:

-        if (record!= null) {
-            record = new IncentiveActivityRecord();
-            record.setIsEligible(true);
-            recordRepo.save(record);
-        }
+        if (record != null) {
+            record.setIsEligible(true);
+            // Optionally also update audit fields here (updatedDate/updatedBy) if needed.
+            recordRepo.save(record);
+        }

Also consider marking the corresponding IncentivePendingActivity as resolved when eligibility becomes true.

Also applies to: 218-228


154-164: Remove redundant null check in updatePendingActivity

The method instantiates IncentivePendingActivity and immediately checks if(incentivePendingActivity!=null). This null check is always true and should be removed—the object was just created on the previous line.

    private void updatePendingActivity(Integer userId, Long recordId, Long activityId, String moduleName) {
        IncentivePendingActivity incentivePendingActivity = new IncentivePendingActivity();
        incentivePendingActivity.setActivityId(activityId);
        incentivePendingActivity.setRecordId(recordId);
        incentivePendingActivity.setUserId(userId);
        incentivePendingActivity.setModuleName(moduleName);
-       if(incentivePendingActivity!=null){
-           incentivePendingActivityRepository.save(incentivePendingActivity);
-       }
+       incentivePendingActivityRepository.save(incentivePendingActivity);
    }

The claims regarding null IDs from unsaved entities and parameter swaps require verification against the actual calling code in the addIncentive method, which could not be accessed for confirmation.

src/main/java/com/iemr/flw/repo/iemr/IncentivePendingActivityRepository.java (1)

9-14: Spring Data derived query method name is invalid and will cause a startup error

The method findByUserIdAndModuleNameActivityId will be parsed by Spring Data as properties userId and moduleNameActivityId. The missing And separator between moduleName and activityId violates Spring Data JPA naming conventions.

Correct the method name to:

Optional<IncentivePendingActivity> findByUserIdAndModuleNameAndActivityId(Integer userId, String moduleName, Long activityId);

Update all call sites accordingly.

src/main/java/com/iemr/flw/controller/MaaMeetingController.java (1)

62-104: /update endpoint missing id parameter; service update will fail without it

The /maa-meetings/update endpoint builds a MaaMeetingRequestDTO but does not set its id, while MaaMeetingService.updateMeeting expects the id to locate the existing meeting. Any call through this controller will fail.

You should:

  • Accept an id from the client (e.g., as @RequestPart("id") String id or @PathVariable Long id), and
  • Set it on the DTO before calling the service:
-    public ResponseEntity<?> updateMeeting(
+    public ResponseEntity<?> updateMeeting(
+            @RequestPart("id") String id,
             @RequestPart("meetingDate") String meetingDate,
             ...
    ) {
        try {
            MaaMeetingRequestDTO dto = new MaaMeetingRequestDTO();
+           dto.setId(Long.parseLong(id));
            ...

Additionally, consider marking optional parts as required = false if partial updates are intended, and update the response message to "Updated Successfully" for clarity.

src/main/java/com/iemr/flw/dto/iemr/PendingActivityDTO.java (1)

1-14: MultipartFile in JSON DTO + capitalized Images field are problematic

  • Field name Images starting with a capital is non-idiomatic and will expose a JSON property Images rather than images; consider renaming to images for consistency.
  • More importantly, this DTO is used as an @RequestBody in IncentiveController.updateIncentive while the controller-level mapping declares consumes = "application/json". Spring MVC cannot deserialize List<MultipartFile> from JSON; file uploads require multipart/form-data with @RequestPart parameters instead of @RequestBody.

Either:

  • Change this DTO to carry JSON-friendly representations (e.g., List<String> imagesBase64), or
  • Change the /incentive/update endpoint to consumes = MediaType.MULTIPART_FORM_DATA_VALUE and use @RequestPart for the file list.
src/main/java/com/iemr/flw/service/impl/IncentiveServiceImpl.java (1)

9-9: LGTM on imports and dependency wiring.

The new imports and autowired dependencies for IncentivePendingActivity, IncentivePendingActivityRepository, MaaMeetingService, and MultipartFile are correctly added to support the new updateIncentive functionality.

Also applies to: 15-17, 24-24, 53-60

src/main/java/com/iemr/flw/domain/iemr/IncentivePendingActivity.java (1)

10-32: Entity structure looks good.

The JPA entity is well-structured with proper annotations, Lombok for boilerplate reduction, explicit column mappings with appropriate constraints (nullable = false on required fields), and correct primary key generation strategy.

Comment on lines +206 to +208
MaaMeetingRequestDTO maaMeetingRequestDTO = new MaaMeetingRequestDTO();
maaMeetingRequestDTO.setMeetingImages(pendingActivityDTO.getImages().toArray(new MultipartFile[0]));
maaMeetingService.updateMeeting(maaMeetingRequestDTO);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Critical: Meeting ID is never set, causing updateMeeting to fail.

The MaaMeetingRequestDTO is created with only meetingImages set, but id is never populated. Looking at MaaMeetingService.updateMeeting(), it immediately calls repository.findById(req.getId()), which will throw EntityNotFoundException because req.getId() is null.

The existingIncentivePendingActivity.getRecordId() likely should be used as the meeting ID.

Apply this diff to fix the missing meeting ID:

 MaaMeetingRequestDTO maaMeetingRequestDTO = new MaaMeetingRequestDTO();
+maaMeetingRequestDTO.setId(existingIncentivePendingActivity.getRecordId());
 maaMeetingRequestDTO.setMeetingImages(pendingActivityDTO.getImages().toArray(new MultipartFile[0]));
 maaMeetingService.updateMeeting(maaMeetingRequestDTO);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
MaaMeetingRequestDTO maaMeetingRequestDTO = new MaaMeetingRequestDTO();
maaMeetingRequestDTO.setMeetingImages(pendingActivityDTO.getImages().toArray(new MultipartFile[0]));
maaMeetingService.updateMeeting(maaMeetingRequestDTO);
MaaMeetingRequestDTO maaMeetingRequestDTO = new MaaMeetingRequestDTO();
maaMeetingRequestDTO.setId(existingIncentivePendingActivity.getRecordId());
maaMeetingRequestDTO.setMeetingImages(pendingActivityDTO.getImages().toArray(new MultipartFile[0]));
maaMeetingService.updateMeeting(maaMeetingRequestDTO);
🤖 Prompt for AI Agents
In src/main/java/com/iemr/flw/service/impl/IncentiveServiceImpl.java around
lines 206 to 208, the MaaMeetingRequestDTO is created with meetingImages but its
id is never set, causing MaaMeetingService.updateMeeting() to call
repository.findById(null) and throw EntityNotFoundException; set the DTO id
using existingIncentivePendingActivity.getRecordId() (or the appropriate
recordId getter on the current scope) before calling updateMeeting so
updateMeeting receives a valid meeting id and can find the entity.

Comment on lines +74 to +110
public MaaMeeting updateMeeting(MaaMeetingRequestDTO req) throws JsonProcessingException {
MaaMeeting existingMeeting = repository.findById(req.getId())
.orElseThrow(() -> new EntityNotFoundException("Meeting not found: " + req.getId()));

// ✅ NULL CHECK
if (req.getMeetingDate() != null) {
existingMeeting.setMeetingDate(req.getMeetingDate());
}
if (req.getPlace() != null) {
existingMeeting.setPlace(req.getPlace());
}
if (req.getParticipants() != null) {
existingMeeting.setParticipants(req.getParticipants());
}
if (req.getAshaId() != null) {
existingMeeting.setAshaId(req.getAshaId());
}
if (req.getCreatedBY() != null) { // ✅ Typo fixed: CreatedBY → CreatedBy
existingMeeting.setCreatedBy(req.getCreatedBY());
}

// Images - only if provided
if (req.getMeetingImages() != null && req.getMeetingImages().length > 0) {
List<String> base64Images = Arrays.stream(req.getMeetingImages())
.filter(file -> file != null && !file.isEmpty())
.map(this::convertToBase64)
.collect(Collectors.toList());
existingMeeting.setMeetingImagesJson(objectMapper.writeValueAsString(base64Images));
}

checkAndAddIncentive(existingMeeting);
if(existingMeeting.getMeetingImagesJson()!=null){
checkAndUpdateIncentive(existingMeeting);

}
return repository.save(existingMeeting);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

updateMeeting requires an id that the controller currently never sets

The partial-update logic and base64 handling here are fine, but updateMeeting calls:

MaaMeeting existingMeeting = repository.findById(req.getId())
    .orElseThrow(() -> new EntityNotFoundException("Meeting not found: " + req.getId()));

If req.getId() is null, this will fail before any update occurs. As implemented, MaaMeetingController.updateMeeting never sets id on MaaMeetingRequestDTO, so calls coming from that endpoint cannot succeed.

Consider one of:

  • Accepting an id in the controller (e.g., @RequestPart("id") or @PathVariable Long id) and setting dto.setId(id) before invoking this service, or
  • Changing the service signature to take the id explicitly and updating callers accordingly.

Also applies to: 113-119

@SauravBizbRolly SauravBizbRolly merged commit d56f085 into PSMRI:sm/release-3.10.0_temp Dec 15, 2025
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.

1 participant