Skip to content

Commit

Permalink
Deliverable details issue fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Sowmya-Raghuram committed Apr 19, 2024
1 parent 9e3a10b commit 211f9b2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public DeliverableDetailsController(DeliverableDetailsService deliverableDetails
@ApiResponse(responseCode = "400", description = "Bad Input"),
@ApiResponse(responseCode = "500", description = "Server Error")}
)
@GetMapping("/need-deliverable/{needId}")
@GetMapping("/deliverable-details/{needId}")
public ResponseEntity<List<DeliverableDetails>> getByNeedId(@PathVariable String needId) {
List<DeliverableDetails> deliverableDetails = deliverableDetailsService.getNDByNeedId(needId);
return ResponseEntity.ok(deliverableDetails);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,24 +113,36 @@ private void createNeedDeliverableForPlan(NeedPlan needPlan, Map<String, String>
}

private void createDeliverableDetails(NeedPlan needPlan, Map<String, String> headers) {

DeliverableDetails deliverableDetails = new DeliverableDetails();
InputParameters inputParameters = new InputParameters();

List<NeedDeliverable> needDeliverable = needDeliverableRepository.findByNeedPlanId(needPlan.getNeedId());
String needDeliverableId = needDeliverable.get(0).getId().toString();
deliverableDetails.setNeedDeliverableId(needDeliverableId);
deliverableDetails.setTaskType(TaskType.Session);
//List<NeedDeliverable> needDeliverable = needDeliverableRepository.findByNeedPlanId(needPlan.getNeedId());
List<NeedDeliverable> needDeliverableList = needDeliverableRepository.findByNeedPlanId(needPlan.getId().toString());

inputParameters.setInputUrl("To be added soon");
inputParameters.setSoftwarePlatform(SoftwarePlatform.GMEET);
if (!needDeliverableList.isEmpty()) {
for (NeedDeliverable needDeliverable : needDeliverableList) {
// Create a new DeliverableDetails object for each NeedDeliverable
DeliverableDetails deliverableDetails = new DeliverableDetails();

// Set properties for DeliverableDetails
deliverableDetails.setNeedDeliverableId(needDeliverable.getId().toString());
deliverableDetails.setTaskType(TaskType.Session);

DeliverableDetails savedDeliverableDetails = deliverableDetailsRepository.save(deliverableDetails);
// Save DeliverableDetails
DeliverableDetails savedDeliverableDetails = deliverableDetailsRepository.save(deliverableDetails);

InputParameters savedInputParameters = inputParametersRepository.save(inputParameters);
// Create a new InputParameters object for each NeedDeliverable
InputParameters inputParameters = new InputParameters();


// Set properties for InputParameters
inputParameters.setDeliverableDetailsId(savedDeliverableDetails.getId().toString());
inputParameters.setInputUrl("To be added soon");
inputParameters.setSoftwarePlatform(SoftwarePlatform.GMEET);

// Save InputParameters
inputParametersRepository.save(inputParameters);
}
} else {
System.out.println("No deliverables found for the given need plan ID.");
}
}

}

0 comments on commit 211f9b2

Please sign in to comment.