Re-organisation des packages

This commit is contained in:
Valentin CZERYBA 2022-04-15 21:34:45 +02:00
parent 268ee6e277
commit 205f8471bf
9 changed files with 33 additions and 22 deletions

View File

@ -1,4 +1,4 @@
package com.covas;
package com.covas.ApplicationScoped;
import org.jboss.logging.Logger;
@ -14,6 +14,9 @@ import javax.enterprise.event.Observes;
import javax.inject.Inject;
import javax.transaction.Transactional;
import com.covas.Entity.UsersEntity;
import com.covas.Enums.Roles;
import org.eclipse.microprofile.config.inject.ConfigProperty;
@ -29,8 +32,8 @@ public class ApplicationLifeCycle {
void onStart(@Observes StartupEvent ev) {
LOGGER.info("The application has started");
if (schemaCreate){
Users users = new Users();
Users users2 = new Users();
UsersEntity users = new UsersEntity();
UsersEntity users2 = new UsersEntity();
if(users.findByPseudo("Peter") == null){

View File

@ -1,21 +1,20 @@
package com.covas;
package com.covas.Entity;
import java.time.LocalDate;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import com.covas.Enums.Roles;
import org.hibernate.annotations.ColumnDefault;
import io.quarkus.hibernate.orm.panache.PanacheEntity;
enum Roles {
User,
Admin
}
@Entity
public class Users extends PanacheEntity {
@Table(name = "users")
public class UsersEntity extends PanacheEntity {
@Column(nullable = false, unique = true)
public String pseudo;
@ -34,7 +33,7 @@ public class Users extends PanacheEntity {
public Roles roles;
public static Users findByPseudo(String pseudo){
public static UsersEntity findByPseudo(String pseudo){
return find("pseudo", pseudo).firstResult();
}

View File

@ -0,0 +1,9 @@
package com.covas;
public enum Roles {
User,
Admin;
Roles(){
}
}

View File

@ -1,4 +1,4 @@
package com.covas;
package com.covas.Json;
import io.quarkus.runtime.annotations.RegisterForReflection;

View File

@ -1,4 +1,4 @@
package com.covas;
package com.covas.Json;
import io.quarkus.runtime.annotations.RegisterForReflection;

View File

@ -1,4 +1,4 @@
package com.covas;
package com.covas.Json;
import io.quarkus.runtime.annotations.RegisterForReflection;

View File

@ -1,4 +1,4 @@
package com.covas;
package com.covas.Resources;
import javax.ws.rs.GET;
import javax.ws.rs.Path;

View File

@ -1,4 +1,4 @@
package com.covas;
package com.covas.Resources;
import java.util.Collections;
import java.util.LinkedHashSet;
@ -11,6 +11,8 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import com.covas.Json.Hello;
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Path("/json")

View File

@ -1,16 +1,11 @@
package com.covas;
package com.covas.Resources;
import java.time.LocalDate;
import java.time.Month;
import java.util.Arrays;
import java.util.HashSet;
import javax.annotation.PostConstruct;
import javax.annotation.security.PermitAll;
import javax.annotation.security.RolesAllowed;
import javax.inject.Inject;
import javax.transaction.TransactionScoped;
import javax.transaction.Transactional;
import javax.ws.rs.CookieParam;
import javax.ws.rs.GET;
import javax.ws.rs.InternalServerErrorException;
@ -22,6 +17,9 @@ import javax.ws.rs.core.NewCookie;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext;
import com.covas.Json.Jwt2;
import com.covas.Json.Token;
import io.smallrye.jwt.auth.principal.JWTParser;
import io.smallrye.jwt.auth.principal.ParseException;
import io.smallrye.jwt.build.Jwt;