update call status
This commit is contained in:
@@ -2,15 +2,15 @@ package net.gepafin.tendermanagement.web.rest.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.gepafin.tendermanagement.enums.CallStatusEnum;
|
||||
import net.gepafin.tendermanagement.enums.UserStatusEnum;
|
||||
import net.gepafin.tendermanagement.model.response.UserResponseBean;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
@@ -120,5 +120,23 @@ public interface CallApi {
|
||||
@PreAuthorize("hasRole('ROLE_SUPER_ADMIN')")
|
||||
public ResponseEntity<Response<CallResponse>> validateCall(HttpServletRequest request,
|
||||
@Parameter(description = "The call id", required = true) @PathVariable("callId") Long callId);
|
||||
|
||||
@Operation(summary = "Api to update call 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)}))
|
||||
})
|
||||
@RequestMapping(value = "/{callId}/status",
|
||||
produces = {"application/json"},
|
||||
method = RequestMethod.PUT)
|
||||
@PreAuthorize("hasRole('ROLE_SUPER_ADMIN')")
|
||||
default ResponseEntity<Response<CallResponse>> updateCallStatus(
|
||||
@Parameter(description = "The call id", required = true) @PathVariable("callId") Long callId,
|
||||
@Parameter(description = "status", required = true)@RequestParam(value = "status", required = true) CallStatusEnum status) {
|
||||
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,16 @@ package net.gepafin.tendermanagement.web.rest.api.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.gepafin.tendermanagement.enums.CallStatusEnum;
|
||||
import net.gepafin.tendermanagement.enums.UserStatusEnum;
|
||||
import net.gepafin.tendermanagement.model.response.UserResponseBean;
|
||||
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.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
@@ -78,4 +83,9 @@ public class CallApiController implements CallApi {
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(call, Status.SUCCESS, Translator.toLocale(GepafinConstant.CALL_FETCH_SUCCESS_MSG)));
|
||||
}
|
||||
@Override
|
||||
public ResponseEntity<Response<CallResponse>> updateCallStatus(@PathVariable Long callId, @RequestParam CallStatusEnum status) {
|
||||
CallResponse updateCall = callService.updateCallStatus(callId, status);
|
||||
return ResponseEntity.ok(new Response<>(updateCall, Status.SUCCESS, Translator.toLocale(GepafinConstant.UPDATE_CALL_STATUS_SUCCESS_MSG)));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user