From d767b84a27b6864897bbfbd8c9250550975c5d45 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 25 Dec 2017 12:34:28 +0300 Subject: email notifications settings --- .../src/main/java/com/juick/service/EmailServiceImpl.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'juick-server-jdbc/src/main/java/com') diff --git a/juick-server-jdbc/src/main/java/com/juick/service/EmailServiceImpl.java b/juick-server-jdbc/src/main/java/com/juick/service/EmailServiceImpl.java index d9e35a00..a8c0595e 100644 --- a/juick-server-jdbc/src/main/java/com/juick/service/EmailServiceImpl.java +++ b/juick-server-jdbc/src/main/java/com/juick/service/EmailServiceImpl.java @@ -68,15 +68,16 @@ public class EmailServiceImpl extends BaseJdbcService implements EmailService { } @Override - public boolean setSubscriptionHour(Integer userId, String account, String hour) { + public boolean setNotificationsEmail(Integer userId, String account) { getJdbcTemplate().update("UPDATE emails SET subscr_hour=NULL WHERE user_id=?", userId); return StringUtils.isNotEmpty(account) && getJdbcTemplate().update( - "UPDATE emails SET subscr_hour=? WHERE user_id=? AND email=?", hour, userId, account) > 0; + "UPDATE emails SET subscr_hour=1 WHERE user_id=? AND email=?", userId, account) > 0; } @Transactional(readOnly = true) @Override public List getEmails(Integer userId) { - return getJdbcTemplate().queryForList("SELECT email FROM emails WHERE user_id=?", String.class, userId); + return getJdbcTemplate().queryForList("SELECT email FROM emails WHERE user_id=? " + + "AND subscr_hour IS NOT NULL", String.class, userId); } } -- cgit v1.2.3