Updated response of form template
This commit is contained in:
@@ -15,6 +15,8 @@ import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface FormTemplateApi {
|
||||
|
||||
@Operation(summary = "Api to create form template",
|
||||
@@ -75,4 +77,18 @@ public interface FormTemplateApi {
|
||||
@DeleteMapping(value = "/{formTemplateId}")
|
||||
ResponseEntity<Response<Void>> deleteFormTemplate(HttpServletRequest request,
|
||||
@Parameter(description = "The form template ID", required = true) @PathVariable("formTemplateId") Long formTemplateId);
|
||||
|
||||
@Operation(summary = "Api to get all form template",
|
||||
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 = "",
|
||||
produces = { "application/json" })
|
||||
ResponseEntity<Response<List<FormTemplateResponseBean>>> getAllFormTemplate(HttpServletRequest request);
|
||||
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@ import org.springframework.http.ResponseEntity;
|
||||
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/formTemplate}")
|
||||
public class FormTemplateApiController implements FormTemplateApi {
|
||||
@@ -49,4 +51,11 @@ public class FormTemplateApiController implements FormTemplateApi {
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(null, Status.SUCCESS, Translator.toLocale(GepafinConstant.FORM_TEMPLATE_DELETED_SUCCESSFULLY)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<List<FormTemplateResponseBean>>> getAllFormTemplate(HttpServletRequest request) {
|
||||
List<FormTemplateResponseBean> formTemplateResponseBeans=formTemplateService.getAllFormTemplate(request);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(formTemplateResponseBeans, Status.SUCCESS, Translator.toLocale(GepafinConstant.FORM_FIELD_FETCHED_SUCCESSFULLY)));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user