From c3cf17e77ee86aaed95f44cf7a58939bd1bf746f Mon Sep 17 00:00:00 2001 From: Luke <lomah001@gold.ac.uk> Date: Mon, 13 May 2019 12:41:43 +0100 Subject: [PATCH] upd: added relevant fields to user and user profile objects --- .../com/backend/glowhouse/model/User.java | 41 +++++++++++++++++ .../glowhouse/model/response/UserProfile.java | 45 ++++++++++++++++++- 2 files changed, 84 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/backend/glowhouse/model/User.java b/src/main/java/com/backend/glowhouse/model/User.java index 3991f24..76add86 100644 --- a/src/main/java/com/backend/glowhouse/model/User.java +++ b/src/main/java/com/backend/glowhouse/model/User.java @@ -2,10 +2,12 @@ package com.backend.glowhouse.model; import org.springframework.data.annotation.Id; import org.springframework.data.mongodb.core.mapping.Document; +import org.springframework.data.mongodb.core.mapping.Field; import javax.validation.constraints.Email; import javax.validation.constraints.NotBlank; import javax.validation.constraints.Size; +import java.util.Date; import java.util.HashSet; import java.util.Set; @@ -14,6 +16,10 @@ public class User { @Id private String id; + private Date createdAt; + + private int nthGrow; + @NotBlank @Size(max = 40) private String name; @@ -35,6 +41,8 @@ public class User { private Device device; + private Date joinedAt; + public User() {} public User(String name, String username, String email, String password) { @@ -52,6 +60,30 @@ public class User { this.id = id; } + public Date getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(Date createdAt) { + this.createdAt = createdAt; + } + + public int getNthGrow() { + return nthGrow; + } + + public void setNthGrow(int nthGrow) { + this.nthGrow = nthGrow; + } + + public Device getDevice() { + return device; + } + + public void setDevice(Device device) { + this.device = device; + } + public String getName() { return name; } @@ -92,6 +124,14 @@ public class User { this.roles = roles; } + public Date getJoinedAt() { + return joinedAt; + } + + public void setJoinedAt(Date joinedAt) { + this.joinedAt = joinedAt; + } + @Override public String toString() { return "User{" + @@ -101,6 +141,7 @@ public class User { ", email='" + email + '\'' + ", password='" + password + '\'' + ", roles=" + roles + + ", joinedAt=" + joinedAt + '}'; } } diff --git a/src/main/java/com/backend/glowhouse/model/response/UserProfile.java b/src/main/java/com/backend/glowhouse/model/response/UserProfile.java index e52d673..e309664 100644 --- a/src/main/java/com/backend/glowhouse/model/response/UserProfile.java +++ b/src/main/java/com/backend/glowhouse/model/response/UserProfile.java @@ -1,16 +1,25 @@ package com.backend.glowhouse.model.response; +import java.util.Date; + public class UserProfile { private String id; private String username; private String name; + private String email; + private String password; + private String deviceId; + private long joinedAt; - public UserProfile() {} - public UserProfile(String id, String username, String name) { + public UserProfile(String id, String username, String name, String email, String password, String deviceId, long joinedAt) { this.id = id; this.username = username; this.name = name; + this.email = email; + this.password = password; + this.deviceId = deviceId; + this.joinedAt = joinedAt; } public String getId() { @@ -36,4 +45,36 @@ public class UserProfile { public void setName(String name) { this.name = name; } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public long getJoinedAt() { + return joinedAt; + } + + public void setJoinedAt(long joinedAt) { + this.joinedAt = joinedAt; + } } -- GitLab