aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java/com/juick/server/PrivacyQueries.java
diff options
context:
space:
mode:
Diffstat (limited to 'juick-server/src/main/java/com/juick/server/PrivacyQueries.java')
-rw-r--r--juick-server/src/main/java/com/juick/server/PrivacyQueries.java32
1 files changed, 0 insertions, 32 deletions
diff --git a/juick-server/src/main/java/com/juick/server/PrivacyQueries.java b/juick-server/src/main/java/com/juick/server/PrivacyQueries.java
deleted file mode 100644
index 40fc82c4..00000000
--- a/juick-server/src/main/java/com/juick/server/PrivacyQueries.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.juick.server;
-
-import com.juick.Tag;
-import com.juick.User;
-import org.springframework.jdbc.core.JdbcTemplate;
-
-/**
- * Created by vitalyster on 19.10.2016.
- */
-public class PrivacyQueries {
- public enum PrivacyResult {
- Removed, Added
- }
- public static PrivacyResult blacklistUser(JdbcTemplate jdbc, User user, User target) {
- int result = jdbc.update("DELETE FROM bl_users WHERE user_id=? AND bl_user_id=?", user.getUid(), target.getUid());
- if (result > 0) {
- return PrivacyResult.Removed;
- } else {
- jdbc.update("INSERT INTO bl_users(user_id,bl_user_id) VALUES (?,?)", user.getUid(), target.getUid());
- return PrivacyResult.Added;
- }
- }
- public static PrivacyResult blacklistTag(JdbcTemplate jdbc, User user, Tag tag) {
- int result = jdbc.update("DELETE FROM bl_tags WHERE user_id=? AND tag_id=?", user.getUid(), tag.TID);
- if (result > 0) {
- return PrivacyResult.Removed;
- } else {
- jdbc.update("INSERT INTO bl_tags(user_id,tag_id) VALUES (?,?)", user.getUid(), tag.TID);
- return PrivacyResult.Added;
- }
- }
-}