get id users with uuid
This commit is contained in:
parent
dabcd87485
commit
4ea644e1d4
@ -1,21 +1,32 @@
|
|||||||
package com.covas.Entity;
|
package com.covas.Entity;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import javax.annotation.Generated;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
|
import javax.persistence.Id;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import com.covas.Classes.Hash;
|
import com.covas.Classes.Hash;
|
||||||
|
|
||||||
import org.hibernate.annotations.ColumnDefault;
|
import org.hibernate.annotations.ColumnDefault;
|
||||||
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
|
|
||||||
import io.quarkus.hibernate.orm.panache.PanacheEntity;
|
import io.quarkus.hibernate.orm.panache.PanacheEntityBase;
|
||||||
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "users")
|
@Table(name = "users")
|
||||||
public class UsersEntity extends PanacheEntity {
|
public class UsersEntity extends PanacheEntityBase {
|
||||||
|
@Id
|
||||||
|
@Column(name = "id")
|
||||||
|
@GeneratedValue(generator = "UUID")
|
||||||
|
@GenericGenerator(name = "UUID", strategy = "org.hibernate.id.UUIDGenerator")
|
||||||
|
public UUID id;
|
||||||
|
|
||||||
@Column(nullable = false, unique = true)
|
@Column(nullable = false, unique = true)
|
||||||
public String pseudo;
|
public String pseudo;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.covas.Resources;
|
package com.covas.Resources;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import javax.ws.rs.GET;
|
import javax.ws.rs.GET;
|
||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
import javax.ws.rs.PathParam;
|
import javax.ws.rs.PathParam;
|
||||||
@ -23,9 +25,9 @@ public class UsersRessources {
|
|||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("{id}")
|
@Path("{id}")
|
||||||
public Response getSingleUser(@PathParam("id") Long id){
|
public Response getSingleUser(@PathParam("id") String id){
|
||||||
LOGGER.info(id);
|
UUID uid = UUID.fromString(id);
|
||||||
UsersEntity users = UsersEntity.findById(id);
|
UsersEntity users = UsersEntity.findById(uid);
|
||||||
if(users == null){
|
if(users == null){
|
||||||
return Response.status(Response.Status.NOT_FOUND).build();
|
return Response.status(Response.Status.NOT_FOUND).build();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user