aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/service/EmailServiceImpl.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2020-03-10 22:51:04 +0300
committerGravatar Vitaly Takmazov2020-03-10 22:51:04 +0300
commit301275c432501d9709168e69bb685c073fb621de (patch)
tree249d7e42f61f0917e1f426ab281fa5310c531ee1 /src/main/java/com/juick/service/EmailServiceImpl.java
parentc28afe791bd1be6ba2999d688f4ea2b00925ad37 (diff)
Mail unsubscribe API
Diffstat (limited to 'src/main/java/com/juick/service/EmailServiceImpl.java')
-rw-r--r--src/main/java/com/juick/service/EmailServiceImpl.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main/java/com/juick/service/EmailServiceImpl.java b/src/main/java/com/juick/service/EmailServiceImpl.java
index 6f0cf995..8d053f50 100644
--- a/src/main/java/com/juick/service/EmailServiceImpl.java
+++ b/src/main/java/com/juick/service/EmailServiceImpl.java
@@ -17,6 +17,7 @@
package com.juick.service;
+import com.juick.model.User;
import org.apache.commons.lang3.StringUtils;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
@@ -66,6 +67,12 @@ public class EmailServiceImpl extends BaseJdbcService implements EmailService {
.addValue("email", account)) > 0;
}
+ @Override
+ public boolean disableEmail(User user, String account) {
+ return getJdbcTemplate().update("UPDATE emails SET subscr_hour=NULL " +
+ "WHERE user_id=? AND email=?", user.getUid(), account) > 0;
+ }
+
@Transactional(readOnly = true)
@Override
public String getNotificationsEmail(Integer userId) {