diff --git a/README.md b/README.md index 3824fc5..bbc54ea 100644 --- a/README.md +++ b/README.md @@ -1,59 +1,12 @@ -# covas-quarkus Project +# Backend COVAS -This project uses Quarkus, the Supersonic Subatomic Java Framework. +C'est la partie backend du projet COVAS généré par le générateur fourni par le framework QUARKUS (Projet semblable à Spring boot de RedHat) -If you want to learn more about Quarkus, please visit its website: https://quarkus.io/ . +## Statut de l'utilisateur -## Running the application in dev mode - -You can run your application in dev mode that enables live coding using: -```shell script -./mvnw compile quarkus:dev -``` - -> **_NOTE:_** Quarkus now ships with a Dev UI, which is available in dev mode only at http://localhost:8080/q/dev/. - -## Packaging and running the application - -The application can be packaged using: -```shell script -./mvnw package -``` -It produces the `quarkus-run.jar` file in the `target/quarkus-app/` directory. -Be aware that it’s not an _über-jar_ as the dependencies are copied into the `target/quarkus-app/lib/` directory. - -The application is now runnable using `java -jar target/quarkus-app/quarkus-run.jar`. - -If you want to build an _über-jar_, execute the following command: -```shell script -./mvnw package -Dquarkus.package.type=uber-jar -``` - -The application, packaged as an _über-jar_, is now runnable using `java -jar target/*-runner.jar`. - -## Creating a native executable - -You can create a native executable using: -```shell script -./mvnw package -Pnative -``` - -Or, if you don't have GraalVM installed, you can run the native executable build in a container using: -```shell script -./mvnw package -Pnative -Dquarkus.native.container-build=true -``` - -You can then execute your native executable with: `./target/covas-quarkus-1.0-runner` - -If you want to learn more about building native executables, please consult https://quarkus.io/guides/maven-tooling. - -## Related Guides +-1 : suppression +0 : desactivé +1 : activé +2 : en attente de confirmation -## Provided Code - -### RESTEasy JAX-RS - -Easily start your RESTful Web Services - -[Related guide section...](https://quarkus.io/guides/getting-started#the-jax-rs-resources) diff --git a/src/main/java/com/covas/Entity/UsersEntity.java b/src/main/java/com/covas/Entity/UsersEntity.java index 2f4f302..364beae 100644 --- a/src/main/java/com/covas/Entity/UsersEntity.java +++ b/src/main/java/com/covas/Entity/UsersEntity.java @@ -37,10 +37,8 @@ public class UsersEntity extends PanacheEntityBase { public String firstName; @Column(nullable = false) public LocalDate birth; - @ColumnDefault("false") - public Boolean status; - @ColumnDefault("false") - public Boolean active_mail; + @ColumnDefault("0") + public Short status; @Column(nullable = false) public String password; @Column(nullable = false) @@ -64,7 +62,7 @@ public class UsersEntity extends PanacheEntityBase { users.name = name; users.firstName = firstName; users.birth = birth; - users.status = true; + users.status = 2; users.password = Hash.encryptSHA512(password); users.roles = roles; users.created_at = LocalDateTime.now(); diff --git a/src/main/java/com/covas/Resources/MailRessource.java b/src/main/java/com/covas/Resources/MailRessource.java index 66731fc..a126c8a 100644 --- a/src/main/java/com/covas/Resources/MailRessource.java +++ b/src/main/java/com/covas/Resources/MailRessource.java @@ -59,11 +59,11 @@ public class MailRessource { return Response.status(Response.Status.NOT_ACCEPTABLE).build(); } redisClient.del(Arrays.asList(id)); - if(users.active_mail){ + if(users.status == 1){ return Response.status(Response.Status.NOT_MODIFIED).build(); } - users.active_mail = true; + users.status = 1; users.persist(); if(users.isPersistent()){ diff --git a/src/main/java/com/covas/Resources/TokenRessource.java b/src/main/java/com/covas/Resources/TokenRessource.java index a9ef3c6..20404e8 100644 --- a/src/main/java/com/covas/Resources/TokenRessource.java +++ b/src/main/java/com/covas/Resources/TokenRessource.java @@ -64,7 +64,7 @@ public class TokenRessource { if(!password.equals(users.password)) { return Response.status(Response.Status.NOT_ACCEPTABLE).build(); } - if(!users.status){ + if(users.status != 1){ return Response.status(Response.Status.FORBIDDEN).build(); } // Create a JWT token signed using the 'HS256' algorithm diff --git a/src/main/java/com/covas/Resources/UsersRessources.java b/src/main/java/com/covas/Resources/UsersRessources.java index f2d9251..cefe303 100644 --- a/src/main/java/com/covas/Resources/UsersRessources.java +++ b/src/main/java/com/covas/Resources/UsersRessources.java @@ -48,7 +48,7 @@ public class UsersRessources { return false; } String name = new String(Base64.decode(userCookie), StandardCharsets.UTF_8); - if (!name.equals(users.pseudo) && (!users.status)) { + if (!name.equals(users.pseudo) && (users.status != 1)) { return false; } return true; @@ -166,8 +166,7 @@ public class UsersRessources { usersNew.password = Hash .encryptSHA512(Base64.toBase64String(users.password.getBytes(StandardCharsets.UTF_8))); usersNew.roles = users.roles; - usersNew.status = false; - usersNew.active_mail = false; + usersNew.status = 2; usersNew.persist(); if (usersNew.isPersistent()) { status = Response.Status.CREATED; @@ -209,8 +208,7 @@ public class UsersRessources { usersNew.password = Hash .encryptSHA512(Base64.toBase64String(users.password.getBytes(StandardCharsets.UTF_8))); usersNew.roles = users.roles; - usersNew.status = false; - usersNew.active_mail = true; + usersNew.status = 2; usersNew.persist(); if (usersNew.isPersistent()) { status = Response.Status.CREATED; @@ -233,7 +231,7 @@ public class UsersRessources { Response.Status status = getResponseCheck(ctx, userCookie, user); if (status.equals(Response.Status.OK)) { - user.status = false; + user.status = 0; user.updated_at = LocalDateTime.now(); user.deleted_at = LocalDateTime.now(); user.persist(); @@ -258,7 +256,7 @@ public class UsersRessources { if (singleUser == null) { status = Response.Status.NOT_FOUND; } else { - singleUser.status = false; + singleUser.status = 0; singleUser.updated_at = LocalDateTime.now(); singleUser.deleted_at = LocalDateTime.now(); singleUser.persist(); @@ -296,9 +294,9 @@ public class UsersRessources { usersOrig.password = Hash .encryptSHA512(Base64.toBase64String(users.password.getBytes(StandardCharsets.UTF_8))); usersOrig.roles = users.roles; - if(users.status){ + if(users.status == 1){ usersOrig.deleted_at = null; - usersOrig.status = true; + usersOrig.status = 1; } usersOrig.persist(); if (!usersOrig.isPersistent()) {