Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import br.com.acta.common.handler.exception.*;
import com.google.i18n.phonenumbers.NumberParseException;
import jakarta.validation.ConstraintViolationException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.dao.OptimisticLockingFailureException;
import org.springframework.http.HttpStatus;
Expand All @@ -24,6 +25,7 @@
import java.util.List;

@ControllerAdvice
@Slf4j
public class GlobalExceptionHandler {
@ExceptionHandler(FirebaseIdTokenException.class)
public ResponseEntity<ErroResponse> handleFirebaseIdToken(FirebaseIdTokenException fite){
Expand Down Expand Up @@ -239,15 +241,16 @@ public ResponseEntity<ErroResponse> handleAccessDenied(){
}

@ExceptionHandler(RuntimeException.class)
public ResponseEntity<ErroResponse> handleRuntime(){
public ResponseEntity<ErroResponse> handleRuntime(RuntimeException exception){
log.error("Erro interno não tratado", exception);
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(new ErroResponse(List.of("Ocorreu um erro interno inesperado"), 500));
// .body(new ErroResponse(List.of(re.getMessage()), 500));
}

@ExceptionHandler(Exception.class)
public ResponseEntity<ErroResponse> handleException(){
public ResponseEntity<ErroResponse> handleException(Exception exception){
log.error("Erro interno não tratado", exception);
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(new ErroResponse(List.of("Ocorreu um erro interno inesperado"), 500));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@Validated
@RestController
@RequestMapping(value = "/api/v1/tarefa/{idTarefa}/alerta", produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/br/com/acta/controller/CausaRaizController.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Validated
@RestController
@RequestMapping(value = "/api/v1", produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/br/com/acta/controller/CicloController.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Validated
@RestController
@RequestMapping(value = "api/v1/ciclo", produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;


@Validated
@RestController
@RequestMapping(value = "api/v1/colaborador", produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Validated
@RestController
@RequestMapping(value = "api/v1/verificacao/{idResultado}/efeito-secundario", produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/br/com/acta/controller/EmpresaController.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Validated
@RestController
@RequestMapping(value = "api/v1/empresa", produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Validated
@RestController
@RequestMapping(value = "api/v1/empresa/{idEmpresa}/endereco", produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/br/com/acta/controller/MetaController.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Validated
@RestController
@RequestMapping(value = "api/v1", produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@Validated
@RestController
@RequestMapping(value = "api/v1", produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
Expand Down Expand Up @@ -48,4 +46,4 @@ public ResponseEntity<Void> excluir(@PathVariable @Positive Long id) {
service.excluir(id);
return ResponseEntity.noContent().build();
}
}
}
2 changes: 0 additions & 2 deletions src/main/java/br/com/acta/controller/PlanoAcaoController.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Validated
@RestController
@RequestMapping(value = "api/v1", produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Validated
@RestController
@RequestMapping(value = "api/v1/problema/{idProblema}/priorizacao", produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/br/com/acta/controller/ProblemaController.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Validated
@RestController
@RequestMapping(value = "api/v1", produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/br/com/acta/controller/TarefaController.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;

@Validated
@RestController
@RequestMapping(value = "api/v1", produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Validated
@RestController
@RequestMapping(value = "api/v1/tarefa/{id}/dependencia", produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Validated
@RestController
@RequestMapping(value = "api/v1/ciclo/{idCiclo}/usuario", produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/br/com/acta/controller/UsuarioController.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import br.com.acta.service.UsuarioCicloService;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PatchMapping;
Expand All @@ -27,7 +26,6 @@
import jakarta.validation.constraints.Positive;
import lombok.RequiredArgsConstructor;

@Validated
@RestController
@RequestMapping(value = "api/v1/usuario", produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Validated
@RestController
@RequestMapping(value = "/api/v1", produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping(value = "/api/v1", produces = MediaType.APPLICATION_JSON_VALUE)
Expand Down
Loading