aboutsummaryrefslogtreecommitdiff
path: root/juick-server
diff options
context:
space:
mode:
Diffstat (limited to 'juick-server')
-rw-r--r--juick-server/src/main/java/com/juick/configuration/DataConfiguration.java1
-rw-r--r--juick-server/src/main/java/com/juick/server/PushQueries.java4
-rw-r--r--juick-server/src/main/java/com/juick/server/helpers/TokensList.java30
-rw-r--r--juick-server/src/main/java/com/juick/service/PushQueriesService.java2
-rw-r--r--juick-server/src/main/java/com/juick/service/PushQueriesServiceImpl.java5
5 files changed, 41 insertions, 1 deletions
diff --git a/juick-server/src/main/java/com/juick/configuration/DataConfiguration.java b/juick-server/src/main/java/com/juick/configuration/DataConfiguration.java
index 9f7331843..89fda7642 100644
--- a/juick-server/src/main/java/com/juick/configuration/DataConfiguration.java
+++ b/juick-server/src/main/java/com/juick/configuration/DataConfiguration.java
@@ -1,7 +1,6 @@
package com.juick.configuration;
import org.apache.commons.dbcp2.BasicDataSource;
-import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
diff --git a/juick-server/src/main/java/com/juick/server/PushQueries.java b/juick-server/src/main/java/com/juick/server/PushQueries.java
index 904b3c0d1..5ee3cef3e 100644
--- a/juick-server/src/main/java/com/juick/server/PushQueries.java
+++ b/juick-server/src/main/java/com/juick/server/PushQueries.java
@@ -41,4 +41,8 @@ public class PushQueries {
return sql.queryForList("SELECT token FROM ios INNER JOIN users " +
"ON (users.id=ios.user_id) WHERE users.id IN (" + StringUtils.collectionToCommaDelimitedString(uids) + ")", String.class);
}
+
+ public static boolean deleteAPNSToken(JdbcTemplate sql, String token) {
+ return sql.update("DELETE FROM ios WHERE token=?", token) > 0;
+ }
}
diff --git a/juick-server/src/main/java/com/juick/server/helpers/TokensList.java b/juick-server/src/main/java/com/juick/server/helpers/TokensList.java
new file mode 100644
index 000000000..cb331e041
--- /dev/null
+++ b/juick-server/src/main/java/com/juick/server/helpers/TokensList.java
@@ -0,0 +1,30 @@
+package com.juick.server.helpers;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.util.List;
+
+/**
+ * Created by vitalyster on 22.11.2016.
+ */
+public class TokensList {
+ private String type;
+ private List<String> tokens;
+
+ @JsonProperty("type")
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public List<String> getTokens() {
+ return tokens;
+ }
+
+ public void setTokens(List<String> tokens) {
+ this.tokens = tokens;
+ }
+}
diff --git a/juick-server/src/main/java/com/juick/service/PushQueriesService.java b/juick-server/src/main/java/com/juick/service/PushQueriesService.java
index 8e7ce5436..fe956c3ac 100644
--- a/juick-server/src/main/java/com/juick/service/PushQueriesService.java
+++ b/juick-server/src/main/java/com/juick/service/PushQueriesService.java
@@ -17,4 +17,6 @@ public interface PushQueriesService {
List<String> getAPNSToken(int uid);
List<String> getAPNSTokens(List<Integer> uids);
+
+ boolean deleteAPNSToken(String token);
}
diff --git a/juick-server/src/main/java/com/juick/service/PushQueriesServiceImpl.java b/juick-server/src/main/java/com/juick/service/PushQueriesServiceImpl.java
index 91861bd98..9bbadef64 100644
--- a/juick-server/src/main/java/com/juick/service/PushQueriesServiceImpl.java
+++ b/juick-server/src/main/java/com/juick/service/PushQueriesServiceImpl.java
@@ -61,6 +61,11 @@ public class PushQueriesServiceImpl extends BaseJdbcService implements PushQueri
}
@Override
+ public boolean deleteAPNSToken(String token) {
+ return getJdbcTemplate().update("DELETE FROM ios WHERE token=?", token) > 0;
+ }
+
+ @Override
public List<String> getAPNSTokens(final List<Integer> uids) {
return getJdbcTemplate().queryForList(
"SELECT token FROM ios INNER JOIN users " +