Implemented crud operation for form,form-field and form-template
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
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.FormRequest;
|
||||
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.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public interface FormApi {
|
||||
|
||||
@Operation(summary = "Api to create form",
|
||||
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) }))
|
||||
})
|
||||
@PostMapping(value = "/call/{callId}", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Response<FormResponseBean>> createForm(HttpServletRequest request,@Parameter(description = "The call ID", required = true) @PathVariable("callId") Long callId,
|
||||
@Parameter(description = "form request object", required = true)
|
||||
@Valid @RequestBody FormRequest formRequest);
|
||||
|
||||
|
||||
@Operation(summary = "Api to update form",
|
||||
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 = "/{formId}",
|
||||
produces = { "application/json" })
|
||||
ResponseEntity<Response<FormResponseBean>> updateForm(HttpServletRequest request,
|
||||
@Parameter(description = "The form ID", required = true) @PathVariable("formId") Long formId,
|
||||
@Parameter(description = "form request object", required = true) @Valid @RequestBody FormRequest formRequest);
|
||||
|
||||
@Operation(summary = "Api to get form by 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 = "/{formId}",
|
||||
produces = { "application/json" })
|
||||
ResponseEntity<Response<FormResponseBean>> getFormById(HttpServletRequest request,
|
||||
@Parameter(description = "The form ID", required = true) @PathVariable("formId") Long formId);
|
||||
|
||||
|
||||
@Operation(summary = "Api to delete form",
|
||||
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) })) })
|
||||
@DeleteMapping(value = "/{formId}")
|
||||
ResponseEntity<Response<Void>> deleteForm(HttpServletRequest request,
|
||||
@Parameter(description = "The form ID", required = true) @PathVariable("formId") Long formId);
|
||||
|
||||
@Operation(summary = "Api to get forms 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<List<FormResponseBean>>> getFormsByCallId(HttpServletRequest request,
|
||||
@Parameter(description = "The call ID", required = true) @PathVariable("callId") Long callId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
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.FormFieldRequest;
|
||||
import net.gepafin.tendermanagement.model.response.FormFieldResponseBean;
|
||||
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.web.bind.annotation.*;
|
||||
|
||||
public interface FormFieldApi {
|
||||
|
||||
@Operation(summary = "Api to create 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) }))
|
||||
})
|
||||
@PostMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Response<FormFieldResponseBean>> createFormField(HttpServletRequest request,
|
||||
@Parameter(description = "form field request object", required = true)
|
||||
@Valid @RequestBody FormFieldRequest formFieldRequest);
|
||||
|
||||
|
||||
@Operation(summary = "Api to update 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) })) })
|
||||
@PutMapping(value = "/{formFieldId}",
|
||||
produces = { "application/json" })
|
||||
ResponseEntity<Response<FormFieldResponseBean>> updateFormField(HttpServletRequest request,
|
||||
@Parameter(description = "The form field ID", required = true) @PathVariable("formFieldId") Long formFieldId,
|
||||
@Parameter(description = "form field request object", required = true) @Valid @RequestBody FormFieldRequest formFieldRequest);
|
||||
|
||||
@Operation(summary = "Api to get form field by 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 = "/{formFieldId}",
|
||||
produces = { "application/json" })
|
||||
ResponseEntity<Response<FormFieldResponseBean>> getFormFieldById(HttpServletRequest request,
|
||||
@Parameter(description = "The form field ID", required = true) @PathVariable("formFieldId") Long formFieldId);
|
||||
|
||||
|
||||
@Operation(summary = "Api to delete 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) })) })
|
||||
@DeleteMapping(value = "/{formFieldId}")
|
||||
ResponseEntity<Response<Void>> deleteForm(HttpServletRequest request,
|
||||
@Parameter(description = "The form field ID", required = true) @PathVariable("formFieldId") Long formFieldId);
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
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.FormTemplateRequest;
|
||||
import net.gepafin.tendermanagement.model.response.FormTemplateResponseBean;
|
||||
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.web.bind.annotation.*;
|
||||
|
||||
public interface FormTemplateApi {
|
||||
|
||||
@Operation(summary = "Api to create 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) }))
|
||||
})
|
||||
@PostMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Response<FormTemplateResponseBean>> createFormTemplate(HttpServletRequest request,
|
||||
@Parameter(description = "form template request object", required = true)
|
||||
@Valid @RequestBody FormTemplateRequest formTemplateRequest);
|
||||
|
||||
|
||||
@Operation(summary = "Api to update 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) })) })
|
||||
@PutMapping(value = "/{formTemplateId}",
|
||||
produces = { "application/json" })
|
||||
ResponseEntity<Response<FormTemplateResponseBean>> updateFormTemplate(HttpServletRequest request,
|
||||
@Parameter(description = "The form template ID", required = true) @PathVariable("formTemplateId") Long formTemplateId,
|
||||
@Parameter(description = "form template request object", required = true) @Valid @RequestBody FormTemplateRequest formTemplateRequest);
|
||||
|
||||
@Operation(summary = "Api to get form template by 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 = "/{formTemplateId}",
|
||||
produces = { "application/json" })
|
||||
ResponseEntity<Response<FormTemplateResponseBean>> getFormTemplateById(HttpServletRequest request,
|
||||
@Parameter(description = "The form template ID", required = true) @PathVariable("formTemplateId") Long formTemplateId);
|
||||
|
||||
|
||||
@Operation(summary = "Api to delete 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) })) })
|
||||
@DeleteMapping(value = "/{formTemplateId}")
|
||||
ResponseEntity<Response<Void>> deleteFormTemplate(HttpServletRequest request,
|
||||
@Parameter(description = "The form template ID", required = true) @PathVariable("formTemplateId") Long formTemplateId);
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
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.FormRequest;
|
||||
import net.gepafin.tendermanagement.model.response.FormResponseBean;
|
||||
import net.gepafin.tendermanagement.model.util.Response;
|
||||
import net.gepafin.tendermanagement.service.FormService;
|
||||
import net.gepafin.tendermanagement.web.rest.api.FormApi;
|
||||
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.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("${openapi.gepafin.base-path:/v1/form}")
|
||||
public class FormApiController implements FormApi {
|
||||
|
||||
@Autowired
|
||||
private FormService formService;
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<FormResponseBean>> createForm(HttpServletRequest request,Long callId, FormRequest formRequest) {
|
||||
FormResponseBean formResponseBean = formService.createForm(request,callId, formRequest);
|
||||
return ResponseEntity.status(HttpStatus.CREATED)
|
||||
.body(new Response<>(formResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.FORM_CREATED_SUCCESSFULLY)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<FormResponseBean>> updateForm(HttpServletRequest request, Long formId, FormRequest formRequest) {
|
||||
FormResponseBean formResponseBean = formService.updateForm(request, formId, formRequest);
|
||||
return ResponseEntity.status(HttpStatus.CREATED)
|
||||
.body(new Response<>(formResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.FORM_UPDATED_SUCCESSFULLY)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<FormResponseBean>> getFormById(HttpServletRequest request, Long formId) {
|
||||
FormResponseBean formResponseBean=formService.getFormById(request,formId);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(formResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.FORM_FETCHED_SUCCESSFULLY)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<Void>> deleteForm(HttpServletRequest request, Long formId) {
|
||||
formService.deleteForm(request,formId);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(null, Status.SUCCESS, Translator.toLocale(GepafinConstant.FORM_DELETED_SUCCESSFULLY)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<List<FormResponseBean>>> getFormsByCallId(HttpServletRequest request, Long callId) {
|
||||
List<FormResponseBean> formResponseBean=formService.getFormsByCallId(request,callId);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(formResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.FORM_FETCHED_SUCCESSFULLY)));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
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.FormFieldRequest;
|
||||
import net.gepafin.tendermanagement.model.response.FormFieldResponseBean;
|
||||
import net.gepafin.tendermanagement.model.util.Response;
|
||||
import net.gepafin.tendermanagement.service.FormFieldService;
|
||||
import net.gepafin.tendermanagement.web.rest.api.FormFieldApi;
|
||||
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.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("${openapi.gepafin.base-path:/v1/formField}")
|
||||
public class FormFieldApiController implements FormFieldApi {
|
||||
|
||||
@Autowired
|
||||
private FormFieldService formFieldService;
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<FormFieldResponseBean>> createFormField(HttpServletRequest request, FormFieldRequest formFieldRequest) {
|
||||
FormFieldResponseBean formFieldResponseBean=formFieldService.createFormField(request,formFieldRequest);
|
||||
return ResponseEntity.status(HttpStatus.CREATED)
|
||||
.body(new Response<>(formFieldResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.FORM_FIELD_CREATED_SUCCESSFULLY)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<FormFieldResponseBean>> updateFormField(HttpServletRequest request, Long formFieldId, FormFieldRequest formFieldRequest) {
|
||||
FormFieldResponseBean formFieldResponseBean=formFieldService.updateFormField(request,formFieldId,formFieldRequest);
|
||||
return ResponseEntity.status(HttpStatus.CREATED)
|
||||
.body(new Response<>(formFieldResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.FORM_FIELD_UPDATED_SUCCESSFULLY)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<FormFieldResponseBean>> getFormFieldById(HttpServletRequest request, Long formFieldId) {
|
||||
FormFieldResponseBean formFieldResponseBean=formFieldService.getFormFieldById(request,formFieldId);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(formFieldResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.FORM_FIELD_FETCHED_SUCCESSFULLY)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<Void>> deleteForm(HttpServletRequest request, Long formFieldId) {
|
||||
formFieldService.deleteFormField(request,formFieldId);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(null, Status.SUCCESS, Translator.toLocale(GepafinConstant.FORM_FIELD_DELETED_SUCCESSFULLY)));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
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.FormTemplateRequest;
|
||||
import net.gepafin.tendermanagement.model.response.FormTemplateResponseBean;
|
||||
import net.gepafin.tendermanagement.model.util.Response;
|
||||
import net.gepafin.tendermanagement.service.FormTemplateService;
|
||||
import net.gepafin.tendermanagement.web.rest.api.FormTemplateApi;
|
||||
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.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("${openapi.gepafin.base-path:/v1/formTemplate}")
|
||||
public class FormTemplateApiController implements FormTemplateApi {
|
||||
|
||||
@Autowired
|
||||
private FormTemplateService formTemplateService;
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<FormTemplateResponseBean>> createFormTemplate(HttpServletRequest request, FormTemplateRequest formTemplateRequest) {
|
||||
FormTemplateResponseBean formTemplateResponseBean=formTemplateService.createTemplateForm(request,formTemplateRequest);
|
||||
return ResponseEntity.status(HttpStatus.CREATED)
|
||||
.body(new Response<>(formTemplateResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.FORM_TEMPLATE_CREATED_SUCCESSFULLY)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<FormTemplateResponseBean>> updateFormTemplate(HttpServletRequest request, Long formTemplateId, FormTemplateRequest formTemplateRequest) {
|
||||
FormTemplateResponseBean formTemplateResponseBean=formTemplateService.updateTemplateForm(request,formTemplateId,formTemplateRequest);
|
||||
return ResponseEntity.status(HttpStatus.CREATED)
|
||||
.body(new Response<>(formTemplateResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.FORM_TEMPLATE_UPDATED_SUCCESSFULLY)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<FormTemplateResponseBean>> getFormTemplateById(HttpServletRequest request, Long formTemplateId) {
|
||||
FormTemplateResponseBean formTemplateResponseBean=formTemplateService.getFormTemplateById(request, formTemplateId);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(formTemplateResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.FORM_TEMPLATE_FETCHED_SUCCESSFULLY)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<Void>> deleteFormTemplate(HttpServletRequest request, Long formTemplateId) {
|
||||
formTemplateService.deleteFormTemplate(request,formTemplateId);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(null, Status.SUCCESS, Translator.toLocale(GepafinConstant.FORM_TEMPLATE_DELETED_SUCCESSFULLY)));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user