Skip to content

refactor(Bookmark): 북마크 삭제 softDelete로 변경#185

Merged
Jjiggu merged 1 commit into
developfrom
refactor/#178-isBookmark
Jul 29, 2025
Merged

refactor(Bookmark): 북마크 삭제 softDelete로 변경#185
Jjiggu merged 1 commit into
developfrom
refactor/#178-isBookmark

Conversation

@Jjiggu

@Jjiggu Jjiggu commented Jul 29, 2025

Copy link
Copy Markdown
Contributor

작업 요약

  • 북마크 삭제 softDelete로 변경

Issue Link

#178

문제점 및 어려움

해결 방안

Reference

Summary by CodeRabbit

  • 신규 기능

    • 북마크의 소프트 삭제(Soft Delete) 기능이 도입되어, 북마크 삭제 시 실제로 데이터가 삭제되지 않고 비활성화 처리됩니다. 삭제된 북마크는 복원할 수 있습니다.
  • 버그 수정

    • 북마크 목록 및 상태 조회 시 삭제된 북마크가 제외되어 정확한 정보가 제공됩니다.
  • 스타일

    • 일부 컨트롤러 코드의 가독성이 개선되었습니다.

@Jjiggu Jjiggu self-assigned this Jul 29, 2025
@Jjiggu Jjiggu added the refactor 리팩토링 label Jul 29, 2025
@coderabbitai

coderabbitai Bot commented Jul 29, 2025

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

Walkthrough

이 변경사항은 북마크(Bookmark) 엔티티에 소프트 삭제(soft delete) 기능을 도입하고, 관련 서비스, 리포지토리, 컨트롤러에서 북마크의 삭제 상태를 고려하도록 쿼리 및 로직을 수정합니다. 북마크 삭제 시 실제 삭제 대신 deleted 플래그를 true로 설정하며, 복원 및 필터링 로직이 추가되었습니다.

Changes

Cohort / File(s) Change Summary
Bookmark 소프트 삭제 도입 및 엔티티 확장
nowait-domain/domain-user-rdb/src/main/java/com/nowait/domainuserrdb/bookmark/entity/Bookmark.java
deleted 필드 추가 및 소프트 삭제/복원 메서드(softDelete, restore) 도입.
BookmarkRepository 쿼리 및 메서드 확장
nowait-domain/domain-user-rdb/src/main/java/com/nowait/domainuserrdb/bookmark/repository/BookmarkRepository.java
모든 주요 메서드에 deleted 플래그 필터 추가, 소프트 삭제 상태를 반영한 신규 메서드 및 JPQL 쿼리 추가.
BookmarkService 소프트 삭제 처리 및 로직 변경
nowait-app-user-api/src/main/java/com/nowait/applicationuser/bookmark/service/BookmarkService.java
북마크 생성/조회/삭제 시 소프트 삭제 상태 반영, 삭제 시 실제 제거 대신 deleted 플래그 변경, 복원 로직 추가, 삭제 메서드 파라미터 변경(bookmarkId → storeId).
StoreServiceImpl 북마크 연동 로직 수정
nowait-app-user-api/src/main/java/com/nowait/applicationuser/store/service/StoreServiceImpl.java
북마크 관련 조회 시 deleted=false 조건 추가로 소프트 삭제 북마크 제외.
BookmarkController 코드 스타일 개선
nowait-app-user-api/src/main/java/com/nowait/applicationuser/bookmark/controller/BookmarkController.java
메서드 파라미터 및 호출부 코드 스타일, 포맷팅 개선(로직 변화 없음).

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Controller
    participant Service
    participant Repository
    participant DB

    User->>Controller: 북마크 생성 요청(storeId)
    Controller->>Service: createBookmark(storeId, user)
    Service->>Repository: findRawByUserAndStoreAndDeletedFalse(user, store)
    alt 북마크 존재(삭제 아님)
        Service->>Controller: 예외 발생(이미 존재)
    else 북마크 존재(삭제됨)
        Service->>Repository: restore()
        Service->>Controller: 복원된 북마크 반환
    else 북마크 없음
        Service->>Repository: save(new Bookmark(deleted=false))
        Service->>Controller: 새 북마크 반환
    end

    User->>Controller: 북마크 삭제 요청(storeId)
    Controller->>Service: deleteBookmark(storeId, user)
    Service->>Repository: findActiveByUserIdAndStoreId(storeId, userId)
    alt 북마크 존재
        Service->>Repository: softDelete()
        Service->>Controller: 삭제 완료 메시지 반환
    else 북마크 없음
        Service->>Controller: 예외 발생(존재하지 않음)
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20분

Possibly related PRs

  • refactor(Bookmark): Bookmark 응답 response 변경 #157: BookmarkServicegetBookmarks 메서드 반환 타입 및 내부 로직을 변경하여, 북마크 DTO 대신 상세 매장 데이터를 반환하도록 수정한 PR로, 본 PR과 동일 메서드에 영향을 주는 코드 레벨의 관련성이 있습니다.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c370158 and 3499607.

📒 Files selected for processing (5)
  • nowait-app-user-api/src/main/java/com/nowait/applicationuser/bookmark/controller/BookmarkController.java (4 hunks)
  • nowait-app-user-api/src/main/java/com/nowait/applicationuser/bookmark/service/BookmarkService.java (4 hunks)
  • nowait-app-user-api/src/main/java/com/nowait/applicationuser/store/service/StoreServiceImpl.java (3 hunks)
  • nowait-domain/domain-user-rdb/src/main/java/com/nowait/domainuserrdb/bookmark/entity/Bookmark.java (2 hunks)
  • nowait-domain/domain-user-rdb/src/main/java/com/nowait/domainuserrdb/bookmark/repository/BookmarkRepository.java (2 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/#178-isBookmark

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Jjiggu Jjiggu merged commit 11a17a8 into develop Jul 29, 2025
1 of 2 checks passed
@github-actions github-actions Bot requested a review from HyemIin July 29, 2025 10:38
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