Updated endpoint to create flow

This commit is contained in:
rajesh
2024-09-12 19:29:04 +05:30
parent 93c9662656
commit 9938b95c85
9 changed files with 56 additions and 34 deletions

View File

@@ -15,17 +15,14 @@ import net.gepafin.tendermanagement.web.rest.api.errors.ErrorConstants;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@Validated
public interface FlowApi {
@Operation(summary = "Api to create flow",
@Operation(summary = "Api to create or update flow",
responses = {
@ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
@@ -34,9 +31,9 @@ public interface FlowApi {
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
@PostMapping(value = "/call/{callId}",
@PutMapping(value = "/call/{callId}",
produces = { "application/json" })
ResponseEntity<Response<FlowResponseBean>> createFlow(HttpServletRequest request,
ResponseEntity<Response<FlowResponseBean>> createOrUpdateFlow(HttpServletRequest request,
@Parameter(description = " Flow request object", required = true) @Valid @RequestBody FlowRequestBean flowRequestBean,
@Parameter(description = "The call ID", required = true) @PathVariable("callId") Long callId);

View File

@@ -26,15 +26,13 @@ public class FlowApiController implements FlowApi {
private FlowService flowService;
@Override
@Transactional(rollbackFor=Exception.class)
public ResponseEntity<Response<FlowResponseBean>> createFlow(HttpServletRequest httpServletRequest, FlowRequestBean flowRequestBean, Long callId) {
FlowResponseBean flowResponseBean=flowService.createFlow(httpServletRequest,flowRequestBean,callId);
public ResponseEntity<Response<FlowResponseBean>> createOrUpdateFlow(HttpServletRequest httpServletRequest, FlowRequestBean flowRequestBean, Long callId) {
FlowResponseBean flowResponseBean=flowService.createOrUpdateFlow(httpServletRequest,flowRequestBean,callId);
return ResponseEntity.status(HttpStatus.CREATED)
.body(new Response<>(flowResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.FLOW_CREATED_SUCCESSFULLY)));
}
@Override
@Transactional(rollbackFor=Exception.class)
public ResponseEntity<Response<FlowResponseBean>> getFlowByCallId(HttpServletRequest request, Long callId) {
FlowResponseBean flowResponseBean=flowService.getFlowByCallId(request,callId);
return ResponseEntity.status(HttpStatus.OK)