get list publishers for a user
This commit is contained in:
parent
5b30166cbf
commit
e97a50b635
@ -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<PublisherEntity> findByUsers(String uuid){
|
||||
return find("users_id", uuid).list();
|
||||
}
|
||||
}
|
22
src/main/java/com/covas/Json/PublisherByUser.java
Normal file
22
src/main/java/com/covas/Json/PublisherByUser.java
Normal file
@ -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<PublisherEntity> publishers;
|
||||
|
||||
public PublisherByUser(String pseudo, Collection<PublisherEntity> publishers){
|
||||
this.pseudo = pseudo;
|
||||
this.publishers = publishers;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user