resolved conflicts

This commit is contained in:
rajesh
2024-09-14 13:15:47 +05:30
36 changed files with 837 additions and 59 deletions

View File

@@ -100,7 +100,7 @@ public interface CallApi {
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
@GetMapping(value = "",
produces = { "application/json" })
ResponseEntity<Response<List<CallDetailsResponseBean>>> getAllCalls();
ResponseEntity<Response<List<CallDetailsResponseBean>>> getAllCalls(HttpServletRequest request);
@Operation(summary = "Api to validate call",

View File

@@ -0,0 +1,55 @@
package net.gepafin.tendermanagement.web.rest.api;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.ExampleObject;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.validation.Valid;
import net.gepafin.tendermanagement.model.request.FlowRequestBean;
import net.gepafin.tendermanagement.model.response.FlowResponseBean;
import net.gepafin.tendermanagement.model.response.FormResponseBean;
import net.gepafin.tendermanagement.model.util.Response;
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.*;
import java.util.List;
@Validated
public interface FlowApi {
@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 = {
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
@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) })) })
@PutMapping(value = "/call/{callId}",
produces = { "application/json" })
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);
@Operation(summary = "Api to get flow by callId",
responses = {
@ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
@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) })) })
@GetMapping(value = "/call/{callId}",
produces = { "application/json" })
ResponseEntity<Response<FlowResponseBean>> getFlowByCallId(HttpServletRequest request,
@Parameter(description = "The call ID", required = true) @PathVariable("callId") Long callId);
}

View File

@@ -65,8 +65,8 @@ public class CallApiController implements CallApi {
@Override
@Transactional(readOnly = true)
public ResponseEntity<Response<List<CallDetailsResponseBean>>> getAllCalls() {
List<CallDetailsResponseBean> calls = callService.getAllCalls();
public ResponseEntity<Response<List<CallDetailsResponseBean>>> getAllCalls(HttpServletRequest request) {
List<CallDetailsResponseBean> calls = callService.getAllCalls(request);
return ResponseEntity.status(HttpStatus.OK)
.body(new Response<>(calls, Status.SUCCESS, Translator.toLocale(GepafinConstant.CALL_FETCH_SUCCESS_MSG)));

View File

@@ -0,0 +1,41 @@
package net.gepafin.tendermanagement.web.rest.api.impl;
import jakarta.servlet.http.HttpServletRequest;
import net.gepafin.tendermanagement.config.Translator;
import net.gepafin.tendermanagement.constants.GepafinConstant;
import net.gepafin.tendermanagement.model.request.FlowRequestBean;
import net.gepafin.tendermanagement.model.response.FlowResponseBean;
import net.gepafin.tendermanagement.model.util.Response;
import net.gepafin.tendermanagement.service.FlowService;
import net.gepafin.tendermanagement.web.rest.api.FlowApi;
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("${openapi.gepafin.base-path:/v1/flow}")
public class FlowApiController implements FlowApi {
@Autowired
private FlowService flowService;
@Override
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
public ResponseEntity<Response<FlowResponseBean>> getFlowByCallId(HttpServletRequest request, Long callId) {
FlowResponseBean flowResponseBean=flowService.getFlowByCallId(request,callId);
return ResponseEntity.status(HttpStatus.OK)
.body(new Response<>(flowResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.FLOW_FETCHED_SUCCESSFULLY)));
}
}