Updated form field response bean

This commit is contained in:
rajesh
2024-08-30 11:52:31 +05:30
parent ea09f62b00
commit 7af37db2ff
20 changed files with 229 additions and 39 deletions

View File

@@ -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 FormFieldApi {
@Operation(summary = "Api to create form field",
@@ -75,4 +77,18 @@ public interface FormFieldApi {
@DeleteMapping(value = "/{formFieldId}")
ResponseEntity<Response<Void>> deleteForm(HttpServletRequest request,
@Parameter(description = "The form field ID", required = true) @PathVariable("formFieldId") Long formFieldId);
@Operation(summary = "Api to get all form field",
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<FormFieldResponseBean>>> getAllFormField(HttpServletRequest request);
}

View File

@@ -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/formField}")
public class FormFieldApiController implements FormFieldApi {
@@ -49,4 +51,11 @@ public class FormFieldApiController implements FormFieldApi {
return ResponseEntity.status(HttpStatus.OK)
.body(new Response<>(null, Status.SUCCESS, Translator.toLocale(GepafinConstant.FORM_FIELD_DELETED_SUCCESSFULLY)));
}
@Override
public ResponseEntity<Response<List<FormFieldResponseBean>>> getAllFormField(HttpServletRequest request) {
List<FormFieldResponseBean> formFieldResponseBeans=formFieldService.getAllFormField(request);
return ResponseEntity.status(HttpStatus.OK)
.body(new Response<>(formFieldResponseBeans, Status.SUCCESS, Translator.toLocale(GepafinConstant.FORM_FIELD_FETCHED_SUCCESSFULLY)));
}
}