aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/data/entities/UserEntity.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2024-07-01 02:46:30 +0300
committerGravatar Vitaly Takmazov2024-07-01 02:46:30 +0300
commit0fe8ba86c60a96b4e67196074ba4ec9944e34d5d (patch)
tree7c1fa51cefe87a286c7dcc465d4baf1254ba4fbe /src/main/java/com/juick/data/entities/UserEntity.java
parent0c00333a7dc86a079182db1578bd0d845cca2b6c (diff)
JPA: map UserEntity to User using `mapstruct` library
Diffstat (limited to 'src/main/java/com/juick/data/entities/UserEntity.java')
-rw-r--r--src/main/java/com/juick/data/entities/UserEntity.java30
1 files changed, 26 insertions, 4 deletions
diff --git a/src/main/java/com/juick/data/entities/UserEntity.java b/src/main/java/com/juick/data/entities/UserEntity.java
index 1984799e..63edadd9 100644
--- a/src/main/java/com/juick/data/entities/UserEntity.java
+++ b/src/main/java/com/juick/data/entities/UserEntity.java
@@ -18,6 +18,8 @@
package com.juick.data.entities;
import jakarta.persistence.*;
+
+import java.time.OffsetDateTime;
import java.util.HashSet;
import java.util.Set;
@@ -25,18 +27,22 @@ import java.util.Set;
@Table(name = "users")
public class UserEntity {
@Id
- @Column(name = "id", columnDefinition = "int(10) unsigned not null auto_increment")
+ @Column(name = "id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
- @Column(name = "nick", columnDefinition = "char(64)")
+ @Column(name = "nick")
private String name;
- @Column(name = "passw", columnDefinition = "char(32)")
+ @Column(name = "passw")
private String password;
- @Column(name = "banned", columnDefinition = "tinyint(1)")
+ @Column(name = "banned")
private boolean banned;
+ @Column(name = "last_seen")
+ private OffsetDateTime seen;
+ @Column
+ private boolean premium;
@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "user")
private Set<EmailEntity> emails = new HashSet<>();
@@ -84,6 +90,14 @@ public class UserEntity {
this.banned = banned;
}
+ public OffsetDateTime getSeen() {
+ return this.seen;
+ }
+
+ public void setSeen(OffsetDateTime seen) {
+ this.seen = seen;
+ }
+
public Set<EmailEntity> getEmails() {
return emails;
}
@@ -123,4 +137,12 @@ public class UserEntity {
public void setTgIds(Set<TelegramEntity> tgIds) {
this.tgIds = tgIds;
}
+
+ public boolean isPremium() {
+ return premium;
+ }
+
+ public void setPremium(boolean premium) {
+ this.premium = premium;
+ }
}