diff --git a/src/main/java/com/example/cosmos_serversb/entities/User.java b/src/main/java/com/example/cosmos_serversb/entities/User.java index eb1b59a..8a9e190 100644 --- a/src/main/java/com/example/cosmos_serversb/entities/User.java +++ b/src/main/java/com/example/cosmos_serversb/entities/User.java @@ -3,12 +3,14 @@ import java.util.HashSet; import java.util.Set; +import com.example.cosmos_serversb.models.SessionManager; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonView; import lombok.Data; import com.example.cosmos_serversb.views.UsersView; +import org.hibernate.Session; import org.hibernate.validator.constraints.Length; public class User { @@ -55,7 +57,7 @@ setName(name); setIconUri(iconUri); setFirstToken(token); - //addToken(this.dummyToken); + addToken(token); this.login = true; } @@ -74,6 +76,7 @@ public void setFirstToken(String firstToken) { this.firstToken = firstToken; } + public Set getTokens() { return tokens; } @@ -82,6 +85,11 @@ this.tokens = tokens; } + public void addToken(String strToken){ + Session session = SessionManager.getInstance().getSession(); + this.tokens.add(session.get(Token.class, strToken)); + } + public String getUri() { return uri; }