diff --git a/src/main/java/com/covas/Entity/PublisherEntity.java b/src/main/java/com/covas/Entity/PublisherEntity.java index 95c3df0..5310c46 100644 --- a/src/main/java/com/covas/Entity/PublisherEntity.java +++ b/src/main/java/com/covas/Entity/PublisherEntity.java @@ -2,6 +2,7 @@ package com.covas.Entity; import java.io.Serializable; import java.time.LocalDateTime; +import java.util.List; import java.util.UUID; import javax.persistence.Column; @@ -58,4 +59,8 @@ public class PublisherEntity extends PanacheEntityBase implements Serializable { @ManyToOne(cascade = CascadeType.ALL) @JoinColumn(name = "users_id", referencedColumnName = "id") public UsersEntity users; + + public static List findByUsers(String uuid){ + return find("users_id", uuid).list(); + } } \ No newline at end of file diff --git a/src/main/java/com/covas/Json/PublisherByUser.java b/src/main/java/com/covas/Json/PublisherByUser.java new file mode 100644 index 0000000..f5a215c --- /dev/null +++ b/src/main/java/com/covas/Json/PublisherByUser.java @@ -0,0 +1,22 @@ +package com.covas.Json; + +import java.util.Collection; + +import com.covas.Entity.PublisherEntity; + +import io.quarkus.runtime.annotations.RegisterForReflection; + +@RegisterForReflection +public class PublisherByUser { + + public final String pseudo; + public final Collection publishers; + + public PublisherByUser(String pseudo, Collection publishers){ + this.pseudo = pseudo; + this.publishers = publishers; + + + } + +} diff --git a/src/main/java/com/covas/Json/PublisherSingle.java b/src/main/java/com/covas/Json/PublisherSingle.java deleted file mode 100644 index 339ee46..0000000 --- a/src/main/java/com/covas/Json/PublisherSingle.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.covas.Json; - -import io.quarkus.runtime.annotations.RegisterForReflection; - -@RegisterForReflection -public class PublisherSingle { - - public final String pseudo; - public final String text; - public final Short status; - public final String url; - - public PublisherSingle(String pseudo, String text, Short status, String url){ - this.pseudo = pseudo; - this.text = text; - this.status = status; - this.url = url; - - } - -} diff --git a/src/main/java/com/covas/Resources/PublisherRessources.java b/src/main/java/com/covas/Resources/PublisherRessources.java index cbb5164..8782c35 100644 --- a/src/main/java/com/covas/Resources/PublisherRessources.java +++ b/src/main/java/com/covas/Resources/PublisherRessources.java @@ -10,7 +10,6 @@ import javax.annotation.security.RolesAllowed; import javax.inject.Inject; import javax.transaction.Transactional; import javax.ws.rs.core.SecurityContext; -import javax.ws.rs.core.Response.Status; import javax.ws.rs.Consumes; import javax.ws.rs.CookieParam; import javax.ws.rs.DELETE; @@ -29,9 +28,8 @@ import javax.ws.rs.core.Response; import com.covas.Classes.Hash; import com.covas.Entity.PublisherEntity; import com.covas.Entity.UsersEntity; -import com.covas.Json.PublisherSingle; +import com.covas.Json.PublisherByUser; import com.covas.Json.UserExist; -import com.covas.Json.UserSingle; import io.quarkus.panache.common.Page; import io.quarkus.panache.common.Parameters; @@ -162,8 +160,8 @@ public class PublisherRessources { } Response responseHttp = Response.status(status).build(); if (status.equals(Response.Status.OK)) { - // responseHttp = Response.status(status).entity(new PublisherSingle(user.name, user.pseudo, user.firstName, user.description)) - //.build(); + responseHttp = Response.status(status).entity(new PublisherByUser(user.pseudo, user.publisher)) + .build(); } return responseHttp; }