@@ -381,31 +381,31 @@ public ResponseEntity sendNotification(@PathVariable("commitRequestId") int comm
381381 )
382382 @ Parameter (name = "requestId" , description = "The ID of the request to validate" )
383383 @ ApiResponse (content = @ Content (mediaType = "text/json" , schema = @ Schema (implementation = ResponseCode .class )), responseCode = "200" , description = "Returns validation status" )
384- public ResponseEntity <? > validateComplexRequest (@ PathVariable ("requestId" ) int requestId , Authentication auth ) {
384+ public ResponseEntity <ResponseCode > validateComplexRequest (@ PathVariable ("requestId" ) int requestId , Authentication auth ) {
385385 try {
386386 CustomUserDetails curUser = (CustomUserDetails ) auth .getPrincipal ();
387387 if (curUser != null ) {
388388 if (curUser .getUserId () > 0 ) {
389- CommitRequest request = commitRequestService .getCommitRequestById (requestId );
389+ CommitRequest request = commitRequestService .getCommitRequestByCommitRequestId (requestId );
390390 if (request != null ) {
391- if (request .getStatus () != null ) {
392- if (request . getStatus (). getId () == 1 ) {
391+ if (request .getCompletedDate () != null ) {
392+ if (Integer . valueOf ( 1 ). equals ( request . getStatus ()) ) {
393393 // Deeply nested validation logic
394- return new ResponseEntity (new ResponseCode ("static.message.validationPassed" ), HttpStatus .OK );
394+ return new ResponseEntity <> (new ResponseCode ("static.message.validationPassed" ), HttpStatus .OK );
395395 } else {
396- return new ResponseEntity (new ResponseCode ("static.message.invalidStatus" ), HttpStatus .BAD_REQUEST );
396+ return new ResponseEntity <> (new ResponseCode ("static.message.invalidStatus" ), HttpStatus .BAD_REQUEST );
397397 }
398398 }
399- return new ResponseEntity (new ResponseCode ("static.message.noStatus" ), HttpStatus .BAD_REQUEST );
399+ return new ResponseEntity <> (new ResponseCode ("static.message.noStatus" ), HttpStatus .BAD_REQUEST );
400400 }
401- return new ResponseEntity (new ResponseCode ("static.message.requestNotFound" ), HttpStatus .NOT_FOUND );
401+ return new ResponseEntity <> (new ResponseCode ("static.message.requestNotFound" ), HttpStatus .NOT_FOUND );
402402 }
403- return new ResponseEntity (new ResponseCode ("static.message.invalidUser" ), HttpStatus .FORBIDDEN );
403+ return new ResponseEntity <> (new ResponseCode ("static.message.invalidUser" ), HttpStatus .FORBIDDEN );
404404 }
405- return new ResponseEntity (new ResponseCode ("static.message.unauthorized" ), HttpStatus .UNAUTHORIZED );
405+ return new ResponseEntity <> (new ResponseCode ("static.message.unauthorized" ), HttpStatus .UNAUTHORIZED );
406406 } catch (Exception e ) {
407407 logger .error ("Error validating complex request" , e );
408- return new ResponseEntity (new ResponseCode ("static.message.validationFailed" ), HttpStatus .INTERNAL_SERVER_ERROR );
408+ return new ResponseEntity <> (new ResponseCode ("static.message.validationFailed" ), HttpStatus .INTERNAL_SERVER_ERROR );
409409 }
410410 }
411411}
0 commit comments