Added get api which is responsable for get next or pevious form
This commit is contained in:
@@ -1,5 +1,17 @@
|
||||
package net.gepafin.tendermanagement.web.rest.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
@@ -7,16 +19,13 @@ 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.enums.ApplicationStatusTypeEnum;
|
||||
import net.gepafin.tendermanagement.enums.FormActionEnum;
|
||||
import net.gepafin.tendermanagement.model.request.ApplicationRequestBean;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.NextOrPreviousFormResponse;
|
||||
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 ApplicationApi {
|
||||
@@ -73,5 +82,37 @@ public interface ApplicationApi {
|
||||
@DeleteMapping(value = "/{applicationId}")
|
||||
ResponseEntity<Response<Void>> deleteApplication(HttpServletRequest request,
|
||||
@Parameter(description = "The application id", required = true) @PathVariable("applicationId") Long applicationId);
|
||||
|
||||
|
||||
@Operation(summary = "Api to get an next or previous form by current form id",
|
||||
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 = "form/{formId}", produces = "application/json")
|
||||
ResponseEntity<Response<NextOrPreviousFormResponse>> getnextOrPreviousForm(HttpServletRequest request,
|
||||
@Parameter(description = "The form id", required = true) @PathVariable("formId") Long formId,
|
||||
@RequestParam("action") FormActionEnum action);
|
||||
|
||||
|
||||
@Operation(summary = "Api to update application status",
|
||||
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 = "/{applicationId}/status", produces = { "application/json" })
|
||||
ResponseEntity<Response<Void>> updateApplicationStatus(HttpServletRequest request,
|
||||
@Parameter(description = "The application id", required = true) @PathVariable("applicationId") Long applicationId,
|
||||
@Parameter(description = "status", required = true)@RequestParam(value = "status", required = true) ApplicationStatusTypeEnum status);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,11 @@ 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.enums.ApplicationStatusTypeEnum;
|
||||
import net.gepafin.tendermanagement.enums.FormActionEnum;
|
||||
import net.gepafin.tendermanagement.model.request.ApplicationRequestBean;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.FlowResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.NextOrPreviousFormResponse;
|
||||
import net.gepafin.tendermanagement.model.util.Response;
|
||||
import net.gepafin.tendermanagement.service.ApplicationService;
|
||||
import net.gepafin.tendermanagement.web.rest.api.ApplicationApi;
|
||||
@@ -61,4 +63,21 @@ public class ApplicationApiController implements ApplicationApi {
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(applications, Status.SUCCESS, Translator.toLocale(GepafinConstant.GET_APPLICATION_SUCCESS_MSG)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<NextOrPreviousFormResponse>> getnextOrPreviousForm(HttpServletRequest request,
|
||||
Long formId, FormActionEnum action) {
|
||||
NextOrPreviousFormResponse data = applicationService.getnextOrPreviousForm(request, formId, action);
|
||||
log.info("Get Next Or Previous Form ");
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(data, Status.SUCCESS, Translator.toLocale(GepafinConstant.GET_APPLICATION_SUCCESS_MSG)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<Void>> updateApplicationStatus(HttpServletRequest request, Long applicationId,
|
||||
ApplicationStatusTypeEnum status) {
|
||||
applicationService.updateApplicationStatus(request, applicationId, status);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(null, Status.SUCCESS, Translator.toLocale(GepafinConstant.GET_APPLICATION_SUCCESS_MSG)));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user