From db14962b7171eb0e713da54eecb032331d551d66 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 20 Apr 2018 11:22:21 +0300 Subject: server: /reactions list --- .../src/main/java/com/juick/service/MessagesServiceImpl.java | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'juick-server-jdbc/src/main') diff --git a/juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java b/juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java index 362a918c..7816ef67 100644 --- a/juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java +++ b/juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java @@ -239,6 +239,16 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ return RecommendStatus.Error; } + @Override + public List listReactions() { + return jdbcTemplate.query("SELECT like_id, description FROM reactions", (RowMapper) (rs, rowNum) -> { + Reaction reaction = new Reaction(rs.getInt("like_id")); + reaction.setDescription(rs.getString("description")); + return reaction; + }); + } + + @Transactional @Override public RecommendStatus likeMessage(int mid, int vuid, int reactionId) throws IllegalArgumentException { if(reactionId == Reaction.LIKE) throw new IllegalArgumentException("this reaction type does not support here"); -- cgit v1.2.3