diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml new file mode 100644 index 0000000..fb094a6 --- /dev/null +++ b/.idea/dataSources.xml @@ -0,0 +1,19 @@ + + + + + mysql + true + com.mysql.jdbc.Driver + jdbc:mysql://localhost:3306/bade + + + + + + + + + + + \ No newline at end of file diff --git a/etunicorn-server.iml b/etunicorn-server.iml index 062692d..d9f71f4 100644 --- a/etunicorn-server.iml +++ b/etunicorn-server.iml @@ -10,6 +10,7 @@ + diff --git a/src/main/java/etunicorn/Application.java b/src/main/java/etunicorn/Application.java index f6b8478..c60c415 100644 --- a/src/main/java/etunicorn/Application.java +++ b/src/main/java/etunicorn/Application.java @@ -10,6 +10,7 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; import org.springframework.jdbc.datasource.DriverManagerDataSource; import javax.sql.DataSource; @@ -21,6 +22,7 @@ import javax.sql.DataSource; */ @SpringBootApplication @EnableAutoConfiguration +@Configuration public class Application { public static void main(String[] args) { @@ -66,8 +68,8 @@ public class Application { // Properties additionalProperties() { // Properties properties = new Properties(); - // properties.setProperty("spring.jpa.hibernale.ddl-auto", "create-drop"); - // properties.setProperty("hibernate.hbm2ddl.auto", "create-drop"); + // properties.setProperty("spring.jpa.hibernate.ddl-auto", "update"); + // properties.setProperty("spring.jpa.database-platform", "org.hibernate.dialect.MySQL5Dialect"); // return properties; // } diff --git a/src/main/java/etunicorn/SecurityInterceptor.java b/src/main/java/etunicorn/SecurityInterceptor.java index d0ce6ab..f6f645f 100644 --- a/src/main/java/etunicorn/SecurityInterceptor.java +++ b/src/main/java/etunicorn/SecurityInterceptor.java @@ -40,6 +40,7 @@ public class SecurityInterceptor extends HandlerInterceptorAdapter { response.setHeader(header, headerValue); } } + response.setStatus(responseEntity.getStatusCodeValue()); response.getWriter().write(responseEntity.getBody().toString()); } diff --git a/src/main/java/etunicorn/controller/BaseController.java b/src/main/java/etunicorn/controller/BaseController.java index e5e1372..8f04dda 100644 --- a/src/main/java/etunicorn/controller/BaseController.java +++ b/src/main/java/etunicorn/controller/BaseController.java @@ -66,6 +66,7 @@ public class BaseController { public ResponseEntity generateError(HttpStatus status, Exception exception, String message) { JSONObject json = generateErrorJSON(status, message); + json.put("exception", exception.getClass().getCanonicalName()); json.put("error", exception.getMessage()); // From http://stackoverflow.com/a/1149721 StringWriter sw = new StringWriter(); diff --git a/src/main/java/etunicorn/controller/RoleController.java b/src/main/java/etunicorn/controller/RoleController.java index 9a18c64..961d7b4 100644 --- a/src/main/java/etunicorn/controller/RoleController.java +++ b/src/main/java/etunicorn/controller/RoleController.java @@ -41,9 +41,6 @@ public class RoleController extends BaseController implements etunicorn.generate @RestrictedTo("ROLE_ADD") public ResponseEntity updateRole(@Valid @RequestBody UpdateRoleRequest updateRoleRequest) { Role oldRole = roleRepository.findByNom(updateRoleRequest.getNom()); - if (oldRole != null) { - return generateError(HttpStatus.CONFLICT, "Un rôle avec le même nom existe déjà"); - } Role role = new Role(); role.setNom(updateRoleRequest.getNom()); try { -- libgit2 0.21.2