From a1f9fe5ea28ec28d7cda704d8ef79ca2bd890195 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 18 Oct 2018 12:45:58 +0300 Subject: last message in pm groups --- juick-common/src/main/java/com/juick/Chat.java | 24 ++++++++++++++++++++++ juick-common/src/main/java/com/juick/User.java | 1 - .../main/java/com/juick/model/PrivateChats.java | 8 ++++---- .../java/com/juick/service/PMQueriesService.java | 3 ++- 4 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 juick-common/src/main/java/com/juick/Chat.java (limited to 'juick-common/src/main/java/com/juick') diff --git a/juick-common/src/main/java/com/juick/Chat.java b/juick-common/src/main/java/com/juick/Chat.java new file mode 100644 index 00000000..c4f105dc --- /dev/null +++ b/juick-common/src/main/java/com/juick/Chat.java @@ -0,0 +1,24 @@ +package com.juick; + +import java.time.Instant; + +public class Chat extends User { + private Instant lastMessageTimestamp; + private String lastMessageText; + + public Instant getLastMessageTimestamp() { + return lastMessageTimestamp; + } + + public void setLastMessageTimestamp(Instant lastMessageTimestamp) { + this.lastMessageTimestamp = lastMessageTimestamp; + } + + public String getLastMessageText() { + return lastMessageText; + } + + public void setLastMessageText(String lastMessageText) { + this.lastMessageText = lastMessageText; + } +} diff --git a/juick-common/src/main/java/com/juick/User.java b/juick-common/src/main/java/com/juick/User.java index 8228230d..765b5abb 100644 --- a/juick-common/src/main/java/com/juick/User.java +++ b/juick-common/src/main/java/com/juick/User.java @@ -26,7 +26,6 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlTransient; -import java.io.Serializable; import java.net.URI; import java.util.ArrayList; import java.util.List; diff --git a/juick-common/src/main/java/com/juick/model/PrivateChats.java b/juick-common/src/main/java/com/juick/model/PrivateChats.java index ad04e649..b6bb48ab 100644 --- a/juick-common/src/main/java/com/juick/model/PrivateChats.java +++ b/juick-common/src/main/java/com/juick/model/PrivateChats.java @@ -18,7 +18,7 @@ package com.juick.model; import com.fasterxml.jackson.annotation.JsonProperty; -import com.juick.User; +import com.juick.Chat; import java.util.List; @@ -26,14 +26,14 @@ import java.util.List; * Created by vt on 24/11/2016. */ public class PrivateChats { - private List users; + private List users; @JsonProperty("pms") - public List getUsers() { + public List getUsers() { return users; } - public void setUsers(List users) { + public void setUsers(List users) { this.users = users; } } diff --git a/juick-common/src/main/java/com/juick/service/PMQueriesService.java b/juick-common/src/main/java/com/juick/service/PMQueriesService.java index 4c70eece..d9e1f18f 100644 --- a/juick-common/src/main/java/com/juick/service/PMQueriesService.java +++ b/juick-common/src/main/java/com/juick/service/PMQueriesService.java @@ -17,6 +17,7 @@ package com.juick.service; +import com.juick.Chat; import com.juick.User; import java.util.List; @@ -35,7 +36,7 @@ public interface PMQueriesService { String getLastView(int uidFrom, int uidTo); - List getPMLastConversationsUsers(int uid, int cnt); + List getLastChats(User user); List getPMMessages(int uid, int uidTo); -- cgit v1.2.3