diff options
Diffstat (limited to 'src/main/java/com/juick/service')
-rw-r--r-- | src/main/java/com/juick/service/ChatService.java (renamed from src/main/java/com/juick/service/PMQueriesService.java) | 12 | ||||
-rw-r--r-- | src/main/java/com/juick/service/ChatServiceImpl.java (renamed from src/main/java/com/juick/service/PMQueriesServiceImpl.java) | 10 |
2 files changed, 11 insertions, 11 deletions
diff --git a/src/main/java/com/juick/service/PMQueriesService.java b/src/main/java/com/juick/service/ChatService.java index bb57b7c3..b09e93b0 100644 --- a/src/main/java/com/juick/service/PMQueriesService.java +++ b/src/main/java/com/juick/service/ChatService.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2020, Juick + * Copyright (C) 2008-2022, Juick * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -26,8 +26,8 @@ import java.util.List; /** * Created by aalexeev on 11/13/16. */ -public interface PMQueriesService { - boolean createPM(int uidFrom, int uid_to, String body); +public interface ChatService { + boolean createMessage(int uidFrom, int uid_to, String body); boolean addPMinRoster(int uid, String jid); @@ -37,9 +37,9 @@ public interface PMQueriesService { List<Chat> getLastChats(User user); - List<Message> getPMMessages(int uid, int uidTo); + List<Message> getChat(int uid, int uidTo); - List<Message> getLastPMInbox(int uid); + List<Message> getInbox(int uid); - List<Message> getLastPMSent(int uid); + List<Message> getOutbox(int uid); } diff --git a/src/main/java/com/juick/service/PMQueriesServiceImpl.java b/src/main/java/com/juick/service/ChatServiceImpl.java index c2e06da5..2d3fe31a 100644 --- a/src/main/java/com/juick/service/PMQueriesServiceImpl.java +++ b/src/main/java/com/juick/service/ChatServiceImpl.java @@ -31,11 +31,11 @@ import java.util.List; * Created by aalexeev on 11/13/16. */ @Repository -public class PMQueriesServiceImpl extends BaseJdbcService implements PMQueriesService { +public class ChatServiceImpl extends BaseJdbcService implements ChatService { @Transactional @Override - public boolean createPM(final int uidFrom, final int uid_to, final String body) { + public boolean createMessage(final int uidFrom, final int uid_to, final String body) { return getJdbcTemplate().update( "INSERT INTO pm(user_id, user_id_to, txt) VALUES (?, ?, ?)", uidFrom, uid_to, body) > 0; @@ -89,7 +89,7 @@ public class PMQueriesServiceImpl extends BaseJdbcService implements PMQueriesSe @Transactional @Override - public List<Message> getPMMessages(final int uid, final int uidTo) { + public List<Message> getChat(final int uid, final int uidTo) { SqlParameterSource sqlParameterSource = new MapSqlParameterSource() .addValue("uid", uid) .addValue("uidTo", uidTo); @@ -113,7 +113,7 @@ public class PMQueriesServiceImpl extends BaseJdbcService implements PMQueriesSe @Transactional(readOnly = true) @Override - public List<Message> getLastPMInbox(final int uid) { + public List<Message> getInbox(final int uid) { return getJdbcTemplate().query( "SELECT pm.user_id, users.nick, pm.txt, pm.ts " + "FROM pm INNER JOIN users ON pm.user_id=users.id WHERE pm.user_id_to=? ORDER BY pm.ts DESC LIMIT 20", @@ -131,7 +131,7 @@ public class PMQueriesServiceImpl extends BaseJdbcService implements PMQueriesSe @Transactional(readOnly = true) @Override - public List<Message> getLastPMSent(final int uid) { + public List<Message> getOutbox(final int uid) { return getJdbcTemplate().query( "SELECT pm.user_id_to, users.nick, pm.txt, " + "pm.ts FROM pm INNER JOIN users ON pm.user_id_to=users.id " + |