aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java/com/juick/service
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-08-15 00:02:13 +0300
committerGravatar Vitaly Takmazov2018-08-15 00:10:16 +0300
commitc8487940bfd0e796e7fd572e543fe2cf88e191b1 (patch)
tree7dd8fea69b4f2362470479add1d545d62f0220d9 /juick-server/src/main/java/com/juick/service
parent2c0cdf69f7273ffd2c2120e93ca9388cb2ec0fcd (diff)
Migrate telegram_chats to telegram table
Diffstat (limited to 'juick-server/src/main/java/com/juick/service')
-rw-r--r--juick-server/src/main/java/com/juick/service/TelegramServiceImpl.java18
1 files changed, 4 insertions, 14 deletions
diff --git a/juick-server/src/main/java/com/juick/service/TelegramServiceImpl.java b/juick-server/src/main/java/com/juick/service/TelegramServiceImpl.java
index 4e37bfac..99cbabf6 100644
--- a/juick-server/src/main/java/com/juick/service/TelegramServiceImpl.java
+++ b/juick-server/src/main/java/com/juick/service/TelegramServiceImpl.java
@@ -36,24 +36,14 @@ public class TelegramServiceImpl extends BaseJdbcService implements TelegramServ
@Transactional
@Override
- public boolean addChat(final Long id) {
- try {
- return getJdbcTemplate().update("INSERT INTO telegram_chats(chat_id) VALUES(?)", id) > 0;
- } catch (DuplicateKeyException e) {
- return true;
- }
- }
-
- @Transactional
- @Override
- public boolean deleteChat(Long id) {
- return getJdbcTemplate().update("DELETE FROM telegram_chats WHERE chat_id=?", id) > 0;
+ public boolean deleteAnonymous(Long id) {
+ return getJdbcTemplate().update("DELETE FROM telegram WHERE tg_id=? AND user_id IS NULL", id) > 0;
}
@Transactional(readOnly = true)
@Override
- public List<Long> getChats() {
- return getJdbcTemplate().queryForList("SELECT chat_id FROM telegram_chats", Long.class);
+ public List<Long> getAnonymous() {
+ return getJdbcTemplate().queryForList("SELECT tg_id FROM telegram WHERE user_id IS NULL", Long.class);
}
@Transactional(readOnly = true)