Skip to content

refactor/SW-22/Back(likes) - ikebookmark 테이블을 likes로 변경#17

Merged
jin2304 merged 1 commit intodevfrom
feat/SW-22
Jan 25, 2026
Merged

refactor/SW-22/Back(likes) - ikebookmark 테이블을 likes로 변경#17
jin2304 merged 1 commit intodevfrom
feat/SW-22

Conversation

@jin2304
Copy link
Member

@jin2304 jin2304 commented Jan 24, 2026

💡 이슈

resolve {#SW-22}

🤩 개요

likebookmark 테이블을 likes로 변경

🧑‍💻 작업 사항

  • SRP(단일 책임 원칙)에 따라 좋아요 기능을 독립 테이블로 분리
  • 향후 확장성 고려, 북마크와 좋아요가 독립적으로 기능 확장

📖 참고 사항

공유할 내용, 레퍼런스, 추가로 발생할 것으로 예상되는 이슈, 스크린샷 등을 넣어 주세요.

Summary by CodeRabbit

릴리스 노트

  • 리팩토링
    • 좋아요 기능의 내부 서비스 및 데이터 구조를 개선하여 코드 유지보수성을 강화했습니다.

✏️ Tip: You can customize this high-level summary in your review settings.

- SRP(단일 책임 원칙)에 따라 좋아요 기능을 독립 테이블로 분리
- 향후 확장성 고려, 북마크와 좋아요가 독립적으로 기능 확장
@jin2304 jin2304 self-assigned this Jan 24, 2026
@jin2304 jin2304 added the ♻️ refactor 코드 리팩토링 label Jan 24, 2026
@coderabbitai
Copy link

coderabbitai bot commented Jan 24, 2026

Walkthrough

이 변경 사항은 좋아요 기능의 리팩토링으로, LikeBookmarkService와 LikeBookmarkDao를 각각 LikesService와 LikesDao로 이름을 변경하고 패키지를 board에서 likes로 이동합니다. 데이터베이스 테이블도 likebookmark에서 likes로 통합되며, 컬럼 이름이 likes_Id에서 likesId로 변경됩니다. BoardController와 BoardService의 의존성 주입도 새로운 서비스로 업데이트되며, MyBatis 매퍼 설정과 SQL 쿼리가 새로운 네임스페이스와 테이블을 참조하도록 조정됩니다. 기능적 동작에는 변화가 없습니다.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 분

Poem

🐰 좋아요 서비스를 정리하며,
새로운 이름 likes로 정성껏,
패키지를 옮기고 테이블 정돈,
일관된 흐름으로 춤을 춘다네,
우아한 리팩토링, 변함없는 기능! ✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive PR 설명이 템플릿 구조는 따르고 있으나, 개요, 작업 사항, 참고 사항 섹션이 구체적인 내용 없이 비어있거나 템플릿 텍스트로만 채워져 있습니다. 개요, 작업 사항, 참고 사항 섹션을 구체적인 내용으로 작성해주세요. 예를 들어, 변경된 파일 목록, 마이그레이션 영향 범위, 테스트 결과 등을 포함해야 합니다.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed PR 제목은 likebookmark 테이블을 likes로 변경하는 주요 변경사항을 명확하고 구체적으로 설명하고 있습니다.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/main/resources/mapper/likes-mapper.xml (1)

40-47: countLikes 쿼리에 resultType 속성이 누락되었습니다.

<select> 태그에 resultType이 지정되지 않아 MyBatis가 반환 타입을 올바르게 매핑하지 못할 수 있습니다. DAO 인터페이스에서 int를 반환하므로 명시적으로 지정해야 합니다.

🐛 수정 제안
     <!-- 게시글 좋아요 수 조회 -->
-    <select id="countLikes">
+    <select id="countLikes" resultType="int">
         select COUNT(*) FROM likes
         WHERE
         board_boardId = #{boardId}
         AND
         is_Liked = TRUE;
     </select>
src/main/java/com/web/SearchWeb/likes/service/LikesService.java (1)

34-50: 동시성 관련 고려 사항

toggleLike 메서드에서 좋아요 상태 확인 후 좋아요 추가/취소 및 카운트 업데이트를 수행합니다. likeBoardON DUPLICATE KEY UPDATE 구문으로 동시 삽입은 안전하게 처리되지만, boardDao.incrementLikeCountdecrementLikeCount에서 동시성 문제가 발생할 수 있습니다.

향후 트래픽 증가 시 UPDATE board SET likes_count = likes_count + 1 방식의 원자적 업데이트 또는 Redis 등을 활용한 카운트 캐싱을 고려해 보세요.

🤖 Fix all issues with AI agents
In `@src/main/java/com/web/SearchWeb/board/controller/BoardController.java`:
- Around line 44-55: Rename the inconsistent field names in BoardController:
change boardservice to boardService and memberservice to memberService, and
update all usages including the constructor parameters and assignments in the
BoardController(BoardService boardservice, MemberService memberservice,
LikesService likesService, BookmarkService bookmarkService) constructor so they
assign to this.boardService, this.memberService, this.likesService,
this.bookmarkService respectively; ensure any other references to boardservice
or memberservice in this class are updated to the new camelCase names.

In `@src/main/java/com/web/SearchWeb/board/service/BoardService.java`:
- Around line 22-31: BoardService에 선언된 필드 likesService와 생성자 파라미터 LikesService
likesService가 클래스 내에서 사용되지 않으므로 해당 필드와 생성자 인자를 제거하세요: BoardService 클래스에서 private
final LikesService likesService 선언을 삭제하고 public BoardService(..., LikesService
likesService, ...) 생성자 시그니처에서 LikesService 파라미터를 제거한 뒤 생성자 내부의 this.likesService
= likesService 할당도 제거합니다; 관련되지 않은 import도 정리하고 향후 사용 의도가 있으면 주석으로 남기거나 실제 로직에
통합하세요.

Comment on lines 44 to 55
private final BoardService boardservice;
private final MemberService memberservice;
private final LikeBookmarkService likebookmarkservice;
private final LikesService likesService;
private final BookmarkService bookmarkService;

@Autowired
public BoardController(BoardService boardservice, MemberService memberservice, LikeBookmarkService likebookmarkservice, BookmarkService bookmarkService) {
public BoardController(BoardService boardservice, MemberService memberservice, LikesService likesService, BookmarkService bookmarkService) {
this.boardservice = boardservice;
this.memberservice = memberservice;
this.likebookmarkservice = likebookmarkservice;
this.likesService = likesService;
this.bookmarkService = bookmarkService;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

필드 네이밍 컨벤션 불일치

새로운 필드 likesService는 camelCase를 올바르게 사용하고 있지만, 기존 필드들(boardservice, memberservice)과 네이밍 컨벤션이 일치하지 않습니다. Java 표준 컨벤션은 camelCase(boardService, memberService)를 권장합니다.

현재 리팩토링 범위 외이지만, 향후 코드 일관성을 위해 기존 필드명도 camelCase로 통일하는 것을 고려해 주세요.

🤖 Prompt for AI Agents
In `@src/main/java/com/web/SearchWeb/board/controller/BoardController.java` around
lines 44 - 55, Rename the inconsistent field names in BoardController: change
boardservice to boardService and memberservice to memberService, and update all
usages including the constructor parameters and assignments in the
BoardController(BoardService boardservice, MemberService memberservice,
LikesService likesService, BookmarkService bookmarkService) constructor so they
assign to this.boardService, this.memberService, this.likesService,
this.bookmarkService respectively; ensure any other references to boardservice
or memberservice in this class are updated to the new camelCase names.

Comment on lines +22 to 31
private final LikesService likesService;
private final CommentService commentService;

@Autowired
public BoardService(BoardDao boardDao, MemberService memberService, LikeBookmarkService likeBookmarkService, CommentService commentService) {
public BoardService(BoardDao boardDao, MemberService memberService, LikesService likesService, CommentService commentService) {
this.boardDao = boardDao;
this.memberService = memberService;
this.likeBookmarkService = likeBookmarkService;
this.likesService = likesService;
this.commentService = commentService;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# First, let's get the full content of BoardService.java to understand all its methods
wc -l src/main/java/com/web/SearchWeb/board/service/BoardService.java

Repository: Searchweb-Dev/Searchweb-Back

Length of output: 139


🏁 Script executed:

# Search for all usages of likesService in BoardService
rg -n 'likesService' src/main/java/com/web/SearchWeb/board/service/BoardService.java

Repository: Searchweb-Dev/Searchweb-Back

Length of output: 299


🏁 Script executed:

# Read the full BoardService.java file
cat -n src/main/java/com/web/SearchWeb/board/service/BoardService.java

Repository: Searchweb-Dev/Searchweb-Back

Length of output: 5090


likesService 의존성이 사용되지 않으므로 제거하세요.

BoardService 클래스의 모든 메서드에서 likesService가 사용되지 않습니다. 불필요한 의존성 주입이므로 필드와 생성자 파라미터에서 제거해 주세요. 향후 사용 계획이 있다면 주석으로 명시하거나, 실제로 사용하는 로직을 추가해 주세요.

🤖 Prompt for AI Agents
In `@src/main/java/com/web/SearchWeb/board/service/BoardService.java` around lines
22 - 31, BoardService에 선언된 필드 likesService와 생성자 파라미터 LikesService likesService가
클래스 내에서 사용되지 않으므로 해당 필드와 생성자 인자를 제거하세요: BoardService 클래스에서 private final
LikesService likesService 선언을 삭제하고 public BoardService(..., LikesService
likesService, ...) 생성자 시그니처에서 LikesService 파라미터를 제거한 뒤 생성자 내부의 this.likesService
= likesService 할당도 제거합니다; 관련되지 않은 import도 정리하고 향후 사용 의도가 있으면 주석으로 남기거나 실제 로직에
통합하세요.

@jin2304 jin2304 merged commit 672cc2d into dev Jan 25, 2026
2 checks passed
@jin2304 jin2304 deleted the feat/SW-22 branch February 1, 2026 07:38
@jin2304 jin2304 changed the title refactor/SW-22/Back(likes): likebookmark 테이블을 likes로 변경 refactor/SW-22/Back(likes) - ikebookmark 테이블을 likes로 변경 Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

♻️ refactor 코드 리팩토링

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant