diff --git a/README.md b/README.md index 3b1dc99..ad67f08 100644 --- a/README.md +++ b/README.md @@ -56,3 +56,9 @@ http://bend-doumi.com:8080/ ## 🗂 DB 구성도 + +## CI/CD +![CI/CD](/src/main/resources/static/images/readMe/GitAction%20Deploy%20Flow.png) + +## Architecture +![CI/CD](/src/main/resources/static/images/readMe/Architecture.png) \ No newline at end of file diff --git a/src/main/java/com/example/doumiproject/controller/LikeController.java b/src/main/java/com/example/doumiproject/controller/LikeController.java index 8344597..0e97c5a 100644 --- a/src/main/java/com/example/doumiproject/controller/LikeController.java +++ b/src/main/java/com/example/doumiproject/controller/LikeController.java @@ -42,7 +42,7 @@ public class LikeController { ))}) public ResponseEntity getLikeInfo(HttpServletRequest request, - @RequestParam(value = "postId") long postId) { + @RequestParam(value = "postId") long postId, @RequestParam(value = "type") String type) { try { @@ -50,7 +50,7 @@ public ResponseEntity getLikeInfo(HttpServletRequest request, long userId = (long) session.getAttribute("userId"); boolean exists = likeService.existsByUserIdAndPostId(userId, postId); - long likeCount = likeService.getCountLike(postId); + long likeCount = likeService.getCountLike(postId, type); LikesDto likesDto = new LikesDto(); likesDto.setExists(exists); @@ -86,7 +86,7 @@ public ResponseEntity addLike(HttpServletRequest request, long userId = (long) session.getAttribute("userId"); likeService.addLike(userId, postId, type); - long likeCount = likeService.getCountLike(postId); + long likeCount = likeService.getCountLike(postId, type); return ResponseEntity.ok(likeCount); } catch (Exception e) { @@ -118,7 +118,7 @@ public ResponseEntity cancelLike(HttpServletRequest request, long userId = (long) session.getAttribute("userId"); likeService.cancelLike(userId, postId, type); - long likeCount = likeService.getCountLike(postId); + long likeCount = likeService.getCountLike(postId, type); return ResponseEntity.ok(likeCount); } catch (Exception e) { diff --git a/src/main/java/com/example/doumiproject/repository/JdbcTemplateLikeRepository.java b/src/main/java/com/example/doumiproject/repository/JdbcTemplateLikeRepository.java index 7940775..3e3f344 100644 --- a/src/main/java/com/example/doumiproject/repository/JdbcTemplateLikeRepository.java +++ b/src/main/java/com/example/doumiproject/repository/JdbcTemplateLikeRepository.java @@ -36,13 +36,13 @@ public void cancelLike(long user_id, long post_id, String type) { } @Override - public long countLike(long post_id) { + public long countLike(long post_id, String type) { String sql = "select count(*) " + "from likes " + - "where post_id = ?"; + "where post_id = ? and type = ? "; - return jdbcTemplate.queryForObject(sql, Long.class, post_id); + return jdbcTemplate.queryForObject(sql, Long.class, post_id, type); } @Override diff --git a/src/main/java/com/example/doumiproject/repository/LikeRepository.java b/src/main/java/com/example/doumiproject/repository/LikeRepository.java index c739c9e..5804454 100644 --- a/src/main/java/com/example/doumiproject/repository/LikeRepository.java +++ b/src/main/java/com/example/doumiproject/repository/LikeRepository.java @@ -7,6 +7,6 @@ public interface LikeRepository { public void addLike(long user_id, long post_id, String type); public void cancelLike(long user_id, long post_id, String type); - public long countLike(long post_id); + public long countLike(long post_id, String type); public boolean existsByUserIdAndPostId(long user_id, long post_id); } diff --git a/src/main/java/com/example/doumiproject/service/LikeService.java b/src/main/java/com/example/doumiproject/service/LikeService.java index 5462263..eaf4b75 100644 --- a/src/main/java/com/example/doumiproject/service/LikeService.java +++ b/src/main/java/com/example/doumiproject/service/LikeService.java @@ -4,6 +4,6 @@ public interface LikeService { public void addLike(long user_id, long post_id, String type); public void cancelLike(long user_id, long post_id, String type); - public long getCountLike(long post_id); + public long getCountLike(long post_id, String type); public boolean existsByUserIdAndPostId(long user_id, long post_id); } diff --git a/src/main/java/com/example/doumiproject/service/LikeServiceImpl.java b/src/main/java/com/example/doumiproject/service/LikeServiceImpl.java index 4b19ebb..a8e692e 100644 --- a/src/main/java/com/example/doumiproject/service/LikeServiceImpl.java +++ b/src/main/java/com/example/doumiproject/service/LikeServiceImpl.java @@ -23,9 +23,9 @@ public void cancelLike(long user_id, long post_id, String type) { } @Override - public long getCountLike(long post_id) { + public long getCountLike(long post_id, String type) { - return likeRepository.countLike(post_id); + return likeRepository.countLike(post_id, type); } @Override diff --git a/src/main/resources/static/images/readMe/Architecture.png b/src/main/resources/static/images/readMe/Architecture.png new file mode 100644 index 0000000..54b581a Binary files /dev/null and b/src/main/resources/static/images/readMe/Architecture.png differ diff --git a/src/main/resources/static/images/readMe/GitAction Deploy Flow.png b/src/main/resources/static/images/readMe/GitAction Deploy Flow.png new file mode 100644 index 0000000..b922134 Binary files /dev/null and b/src/main/resources/static/images/readMe/GitAction Deploy Flow.png differ