APIv3/src/main/java/net/frozenorb/apiv3/model/User.java

47 lines
1.3 KiB
Java
Raw Normal View History

2016-02-12 02:40:06 +01:00
package net.frozenorb.apiv3.model;
import lombok.Getter;
2016-03-21 23:28:17 +01:00
import net.frozenorb.apiv3.weirdStuff.ExcludeFromReplies;
import org.mongodb.morphia.annotations.Entity;
import org.mongodb.morphia.annotations.Id;
2016-02-12 02:40:06 +01:00
2016-02-23 13:14:42 +01:00
import java.time.Instant;
2016-03-21 23:28:17 +01:00
import java.util.Date;
import java.util.HashMap;
2016-02-23 13:14:42 +01:00
import java.util.Map;
import java.util.UUID;
2016-03-21 23:28:17 +01:00
@Entity(value = "users", noClassnameStored = true)
public final class User {
2016-02-12 02:40:06 +01:00
2016-03-21 23:28:17 +01:00
@Id private UUID id;
2016-02-23 13:14:42 +01:00
@Getter private String lastName;
2016-03-21 23:28:17 +01:00
@ExcludeFromReplies @Getter private Map<String, Date> aliases;
2016-02-23 13:14:42 +01:00
@Getter private String otpCode;
@Getter private String password;
@Getter private String passwordSalt;
@Getter private String email;
@Getter private int phoneNumber;
@Getter private String lastSeenOn;
2016-03-21 23:28:17 +01:00
@Getter private Date lastSeenAt;
@Getter private Date firstSeen;
public User() {} // For Morphia
public User(UUID id, String lastName) {
this.id = id;
this.lastName = lastName;
this.aliases = new HashMap<>();
this.otpCode = null;
this.password = null;
this.passwordSalt = null;
this.email = null;
this.phoneNumber = 0;
this.lastSeenOn = "Unknown";
this.lastSeenAt = new Date();
this.firstSeen = new Date();
aliases.put(lastName, new Date());
2016-02-12 02:40:06 +01:00
}
}