Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

๐Ÿ„ :: (Meogo-44) bookmark #45

Merged
merged 3 commits into from
Oct 3, 2024
Merged

๐Ÿ„ :: (Meogo-44) bookmark #45

merged 3 commits into from
Oct 3, 2024

Conversation

meltapplee
Copy link
Member

@meltapplee meltapplee commented Oct 2, 2024

close #44
1
2
แ„‰แ…ณแ„แ…ณแ„…แ…ตแ†ซแ„‰แ…ฃแ†บ 2024-10-03 00 03 48
แ„‰แ…ณแ„แ…ณแ„…แ…ตแ†ซแ„‰แ…ฃแ†บ 2024-10-03 00 50 31

Summary by CodeRabbit

  • New Features

    • ๋ถ๋งˆํฌ ๊ด€๋ฆฌ REST ์ปจํŠธ๋กค๋Ÿฌ ์ถ”๊ฐ€: ๋ถ๋งˆํฌ ์ƒ์„ฑ, ์กฐํšŒ, ์‚ญ์ œ ๊ธฐ๋Šฅ ์ œ๊ณต.
    • ๋ถ๋งˆํฌ๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์„ ๋•Œ ๋ฐœ์ƒํ•˜๋Š” ์˜ˆ์™ธ ์ฒ˜๋ฆฌ ์ถ”๊ฐ€.
  • ๋ณ€๊ฒฝ ์‚ฌํ•ญ

    • schoolId ํ•„๋“œ๊ฐ€ ํ•„์ˆ˜๋กœ ๋ณ€๊ฒฝ๋˜์–ด ๋ถ๋งˆํฌ ์ƒ์„ฑ ์‹œ ๋ฐ˜๋“œ์‹œ ์ œ๊ณตํ•ด์•ผ ํ•จ.
    • ๋ถ๋งˆํฌ ๊ฒ€์ƒ‰ ๋ฐ ์‚ญ์ œ ๋กœ์ง์ด ์‚ฌ์šฉ์ž ๊ธฐ๋ฐ˜์œผ๋กœ ๋ณ€๊ฒฝ๋จ.
  • ๋ฒ„๊ทธ ์ˆ˜์ •

    • ๋ถ๋งˆํฌ ์‚ญ์ œ ์‹œ ์กด์žฌ ์—ฌ๋ถ€ ํ™•์ธ ๋กœ์ง ๊ฐœ์„ .

@meltapplee meltapplee self-assigned this Oct 2, 2024
Copy link

coderabbitai bot commented Oct 2, 2024

Walkthrough

์ด Pull Request๋Š” Bookmark ํด๋ž˜์Šค ๋ฐ ๊ด€๋ จ ๊ตฌ์„ฑ ์š”์†Œ์— ๋Œ€ํ•œ ์—ฌ๋Ÿฌ ๊ฐ€์ง€ ๋ณ€๊ฒฝ ์‚ฌํ•ญ์„ ํฌํ•จํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. Bookmark ํด๋ž˜์Šค์˜ ํŒจํ‚ค์ง€ ์„ ์–ธ์ด ๋ณ€๊ฒฝ๋˜๊ณ , schoolId ์†์„ฑ์ด nullable์—์„œ non-nullable๋กœ ์ˆ˜์ •๋˜์—ˆ์Šต๋‹ˆ๋‹ค. BookmarkRepository ์ธํ„ฐํŽ˜์ด์Šค์˜ ๋ฉ”์„œ๋“œ ์‹œ๊ทธ๋‹ˆ์ฒ˜๊ฐ€ ์‚ฌ์šฉ์ž ๊ด€๋ จ ์ฟผ๋ฆฌ๋กœ ๋ณ€๊ฒฝ๋˜์—ˆ์œผ๋ฉฐ, ์ƒˆ๋กœ์šด BookmarkNotFoundException ์˜ˆ์™ธ๊ฐ€ ๋„์ž…๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ๋˜ํ•œ, ์ƒˆ๋กœ์šด REST ์ปจํŠธ๋กค๋Ÿฌ์ธ BookmarkController๊ฐ€ ์ถ”๊ฐ€๋˜์–ด ๋ถ๋งˆํฌ ๊ด€๋ฆฌ ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.

Changes

ํŒŒ์ผ ๊ฒฝ๋กœ ๋ณ€๊ฒฝ ์š”์•ฝ
src/main/kotlin/org/meogo/domain/bookmark/domain/Bookmark.kt ํŒจํ‚ค์ง€ ์„ ์–ธ ๋ณ€๊ฒฝ: org.meogo.domain.bookmark โ†’ org.meogo.domain.bookmark.domain
schoolId ์†์„ฑ์„ non-nullable๋กœ ๋ณ€๊ฒฝ
src/main/kotlin/org/meogo/domain/bookmark/domain/BookmarkRepository.kt ๋ฉ”์„œ๋“œ ์‹œ๊ทธ๋‹ˆ์ฒ˜ ๋ณ€๊ฒฝ: findAllBySchoolId โ†’ findAllByUser, existsBySchoolIdAndUser โ†’ findBySchoolIdAndUser, deleteBySchoolIdAndUser โ†’ existsBySchoolIdAndUser
src/main/kotlin/org/meogo/domain/bookmark/exception/BookmarkNotFoundException.kt BookmarkNotFoundException ๊ฐ์ฒด ์ถ”๊ฐ€, MeogoException ํ™•์žฅ
src/main/kotlin/org/meogo/domain/bookmark/presentation/BookmarkController.kt ์ƒˆ๋กœ์šด REST ์ปจํŠธ๋กค๋Ÿฌ ์ถ”๊ฐ€, ๋ถ๋งˆํฌ ์ƒ์„ฑ, ์กฐํšŒ, ์ฒดํฌ ๋ฐ ์‚ญ์ œ๋ฅผ ์œ„ํ•œ ๋ฉ”์„œ๋“œ ์ถ”๊ฐ€
src/main/kotlin/org/meogo/domain/bookmark/service/BookmarkService.kt ํŒจํ‚ค์ง€ ์ด๋™, @Transactional ์–ด๋…ธํ…Œ์ด์…˜ ๋ณ€๊ฒฝ, queryBookmarkedPost ๋ฉ”์„œ๋“œ ์‚ญ์ œ ๋ฐ queryBookmarkedSchool ๋ฉ”์„œ๋“œ ์ถ”๊ฐ€, deleteBookmark ๋ฉ”์„œ๋“œ ์ˆ˜์ •
src/main/kotlin/org/meogo/global/error/exception/ErrorCode.kt BOOKMARK_NOT_FOUND ์ƒ์ˆ˜ ์ถ”๊ฐ€

Possibly related PRs

  • ๐Ÿ„ :: (Meogo-13) modif reviewย #15: Bookmark ํด๋ž˜์Šค์˜ schoolId ์†์„ฑ์ด non-nullable๋กœ ์ˆ˜์ •๋œ ๊ฒƒ๊ณผ ๊ด€๋ จํ•˜์—ฌ, Review ํด๋ž˜์Šค์—์„œ๋„ ์œ ์‚ฌํ•œ ๋ณ€๊ฒฝ์ด ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.
  • ๐Ÿ„ :: (Meogo-20) user my pageย #21: BookmarkRepository ์ธํ„ฐํŽ˜์ด์Šค์˜ ๋ฉ”์„œ๋“œ ์‹œ๊ทธ๋‹ˆ์ฒ˜๊ฐ€ ์‚ฌ์šฉ์ž ๊ด€๋ จ ์ฟผ๋ฆฌ๋กœ ๋ณ€๊ฒฝ๋œ ๊ฒƒ์€ ReviewRepository์˜ ์‚ฌ์šฉ์ž ๊ด€๋ จ ๋ฉ”์„œ๋“œ ์ถ”๊ฐ€์™€ ์ผ์น˜ํ•ฉ๋‹ˆ๋‹ค.
  • ๐Ÿ„ :: (Meogo-42) post goodย #43: ์ƒˆ๋กœ์šด Bookmark ํด๋ž˜์Šค ๋„์ž…์€ ๋ฉ”์ธ PR์˜ Bookmark ํด๋ž˜์Šค ์ˆ˜์ •๊ณผ ์ง์ ‘์ ์œผ๋กœ ๊ด€๋ จ์ด ์žˆ์Šต๋‹ˆ๋‹ค.

Suggested labels

core

๐Ÿ‡ ๋ถ๋งˆํฌ๊ฐ€ ์ƒˆ๋กœ ํƒœ์–ด๋‚ฌ๋„ค,
ํ•™๊ต ID๋Š” ์ด์ œ ํ•„์ˆ˜๋ผ๋„ค.
์‚ฌ์šฉ์ž์™€ ํ•จ๊ป˜ํ•˜๋Š” ๋ฉ‹์ง„ ๊ธธ,
๋ถ๋งˆํฌ ๊ด€๋ฆฌ, ์ฆ๊ฑฐ์šด ์ผ!
์ฐพ์„ ์ˆ˜ ์—†๋Š” ๊ฑด ์ด์ œ ์•ˆ๋…•,
์˜ˆ์™ธ ์ฒ˜๋ฆฌ๋กœ ๊ฑฑ์ • ์—†๊ฒ ๋„ค! ๐ŸŒŸ


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

โค๏ธ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 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.

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

๐Ÿงน Outside diff range and nitpick comments (7)
src/main/kotlin/org/meogo/domain/bookmark/exception/BookmarkNotFoundException.kt (1)

6-8: BookmarkNotFoundException ๊ฐ์ฒด ์„ ์–ธ์ด ์ž˜ ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

Kotlin์˜ object ํ‚ค์›Œ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์‹ฑ๊ธ€ํ†ค ์˜ˆ์™ธ๋ฅผ ์ƒ์„ฑํ•œ ๊ฒƒ์€ ์ข‹์€ ๋ฐฉ์‹์ž…๋‹ˆ๋‹ค. MeogoException์„ ์ƒ์†๋ฐ›๊ณ  ํŠน์ • ์˜ค๋ฅ˜ ์ฝ”๋“œ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ๋„ ์ ์ ˆํ•ฉ๋‹ˆ๋‹ค.

๊ฐ€๋…์„ฑ์„ ๋†’์ด๊ธฐ ์œ„ํ•ด ๋‹ค์Œ๊ณผ ๊ฐ™์ด ๊ฐœํ–‰์„ ์ถ”๊ฐ€ํ•˜๋Š” ๊ฒƒ์„ ๊ณ ๋ คํ•ด ๋ณด์„ธ์š”:

object BookmarkNotFoundException : MeogoException(
    ErrorCode.BOOKMARK_NOT_FOUND
)
src/main/kotlin/org/meogo/domain/bookmark/domain/BookmarkRepository.kt (1)

8-8: ์‚ฌ์šฉ์ž ์ค‘์‹ฌ ๋ถ๋งˆํฌ ๊ฒ€์ƒ‰์œผ๋กœ์˜ ๋ณ€๊ฒฝ์„ ์Šน์ธํ•ฉ๋‹ˆ๋‹ค.

์ด ๋ณ€๊ฒฝ์€ ๋ถ๋งˆํฌ ๊ด€๋ฆฌ๋ฅผ ์‚ฌ์šฉ์ž ์ค‘์‹ฌ์œผ๋กœ ๊ฐœ์„ ํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ๋ฐ˜ํ™˜ ํƒ€์ž…์„ List<Bookmark>๋กœ ๋ณ€๊ฒฝํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค. ๋ถ๋งˆํฌ๊ฐ€ ์—†์„ ๊ฒฝ์šฐ null ๋Œ€์‹  ๋นˆ ๋ฆฌ์ŠคํŠธ๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋ฉด null ์ฒดํฌ๋ฅผ ์ค„์ผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์ด ๋ฉ”์„œ๋“œ ์‹œ๊ทธ๋‹ˆ์ฒ˜๋ฅผ ์ˆ˜์ •ํ•˜๋Š” ๊ฒƒ์„ ๊ณ ๋ คํ•ด๋ณด์„ธ์š”:

fun findAllByUser(user: User): List<Bookmark>
src/main/kotlin/org/meogo/global/error/exception/ErrorCode.kt (1)

21-21: LGTM! ๋ถ๋งˆํฌ ๊ด€๋ จ ์˜ค๋ฅ˜ ์ฝ”๋“œ๊ฐ€ ์ ์ ˆํžˆ ์ถ”๊ฐ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

์ƒˆ๋กœ์šด BOOKMARK_NOT_FOUND ์˜ค๋ฅ˜ ์ฝ”๋“œ๊ฐ€ ๊ธฐ์กด ํŒจํ„ด์„ ๋”ฐ๋ผ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์ถ”๊ฐ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ์ด๋Š” PR ๋ชฉํ‘œ์— ์–ธ๊ธ‰๋œ ๋ถ๋งˆํฌ ๊ธฐ๋Šฅ๊ณผ ์ผ์น˜ํ•ฉ๋‹ˆ๋‹ค.

์ž‘์€ ๊ฐœ์„  ์‚ฌํ•ญ์œผ๋กœ, ์˜ค๋ฅ˜ ๋ฉ”์‹œ์ง€์˜ ์ผ๊ด€์„ฑ์„ ์œ„ํ•ด ๋‹ค์Œ๊ณผ ๊ฐ™์ด ๋ณ€๊ฒฝํ•˜๋Š” ๊ฒƒ์„ ๊ณ ๋ คํ•ด ๋ณด์„ธ์š”:

-    BOOKMARK_NOT_FOUND(404, "Bookmark not found"),
+    BOOKMARK_NOT_FOUND(404, "Bookmark not found."),

๋‹ค๋ฅธ ์˜ค๋ฅ˜ ๋ฉ”์‹œ์ง€๋“ค๊ณผ ๋งˆ์ฐฌ๊ฐ€์ง€๋กœ ๋ฌธ์žฅ ๋์— ๋งˆ์นจํ‘œ๋ฅผ ์ถ”๊ฐ€ํ•˜๋ฉด ๋”์šฑ ์ผ๊ด€๋œ ์Šคํƒ€์ผ์ด ๋  ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

src/main/kotlin/org/meogo/domain/bookmark/presentation/BookmarkController.kt (3)

13-17: ํด๋ž˜์Šค ์„ ์–ธ๊ณผ ์ƒ์„ฑ์ž๊ฐ€ ์ž˜ ๊ตฌํ˜„๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

@RestController์™€ @RequestMapping ์–ด๋…ธํ…Œ์ด์…˜์ด ์ ์ ˆํžˆ ์‚ฌ์šฉ๋˜์—ˆ๊ณ , ์ƒ์„ฑ์ž๋ฅผ ํ†ตํ•œ ์˜์กด์„ฑ ์ฃผ์ž…์ด ์ž˜ ๊ตฌํ˜„๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ƒ์„ฑ์ž์— @Autowired ์–ด๋…ธํ…Œ์ด์…˜์„ ์ถ”๊ฐ€ํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค:

 @RestController
 @RequestMapping("/bookmark")
+@Autowired
 class BookmarkController(
     private val bookmarkService: BookmarkService
 ) {

์ด๋Š” ๋ช…์‹œ์ ์œผ๋กœ ์˜์กด์„ฑ ์ฃผ์ž…์„ ๋‚˜ํƒ€๋‚ด๋ฉฐ, ์ฝ”๋“œ์˜ ๊ฐ€๋…์„ฑ์„ ํ–ฅ์ƒ์‹œํ‚ต๋‹ˆ๋‹ค.


19-22: ๋ถ๋งˆํฌ ์ƒ์„ฑ ๋ฉ”์„œ๋“œ๊ฐ€ ์ž˜ ๊ตฌํ˜„๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

POST ์š”์ฒญ์„ ์ฒ˜๋ฆฌํ•˜๋Š” ์—”๋“œํฌ์ธํŠธ๋กœ ์ ์ ˆํžˆ ๊ตฌํ˜„๋˜์—ˆ์Šต๋‹ˆ๋‹ค. @RequestParam์„ ์‚ฌ์šฉํ•˜์—ฌ school_id๋ฅผ ๋ฐ›์•„์˜ค๋Š” ๋ฐฉ์‹์ด ์˜ฌ๋ฐ”๋ฆ…๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์ด ๋ฉ”์„œ๋“œ์˜ ๋ฐ˜ํ™˜ ํƒ€์ž…์„ ๋ช…์‹œ์ ์œผ๋กœ ์ง€์ •ํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค:

 @ResponseStatus(HttpStatus.OK)
 @PostMapping
-fun create(@RequestParam(name = "school_id")schoolId: Int) =
+fun create(@RequestParam(name = "school_id")schoolId: Int): Unit =
     bookmarkService.execute(schoolId)

์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ๋ฉ”์„œ๋“œ์˜ ์˜๋„๊ฐ€ ๋” ๋ช…ํ™•ํ•ด์ง€๊ณ , ์ฝ”๋“œ์˜ ๊ฐ€๋…์„ฑ์ด ํ–ฅ์ƒ๋ฉ๋‹ˆ๋‹ค.


24-30: ๋ถ๋งˆํฌ ์กฐํšŒ ๋ฉ”์„œ๋“œ๋“ค์ด ์ž˜ ๊ตฌํ˜„๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

GET ์š”์ฒญ์„ ์ฒ˜๋ฆฌํ•˜๋Š” ๋‘ ์—”๋“œํฌ์ธํŠธ๊ฐ€ ์ ์ ˆํžˆ ๊ตฌํ˜„๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ๋ฉ”์„œ๋“œ ์ด๋ฆ„์ด ๋ช…ํ™•ํ•˜๊ณ  ์„ค๋ช…์ ์ž…๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์ด ๊ฐ ๋ฉ”์„œ๋“œ์˜ ๋ฐ˜ํ™˜ ํƒ€์ž…์„ ๋ช…์‹œ์ ์œผ๋กœ ์ง€์ •ํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค:

 @GetMapping("/query/my")
-fun myBookmarks() =
+fun myBookmarks(): List<BookmarkedSchoolResponse> =
     bookmarkService.queryBookmarkedSchool()

 @GetMapping("/query")
-fun isBookmarked(@RequestParam(name = "school_id")schoolId: Int) =
+fun isBookmarked(@RequestParam(name = "school_id")schoolId: Int): Boolean =
     bookmarkService.queryIsBookmarked(schoolId)

์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ๊ฐ ๋ฉ”์„œ๋“œ๊ฐ€ ์–ด๋–ค ํƒ€์ž…์˜ ๋ฐ์ดํ„ฐ๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋Š”์ง€ ๋ช…ํ™•ํ•ด์ง€๊ณ , ์ฝ”๋“œ์˜ ๊ฐ€๋…์„ฑ๊ณผ ์œ ์ง€๋ณด์ˆ˜์„ฑ์ด ํ–ฅ์ƒ๋ฉ๋‹ˆ๋‹ค.

src/main/kotlin/org/meogo/domain/bookmark/service/BookmarkService.kt (1)

31-35: ๋ณ€์ˆ˜๋ช… ๋ณ€๊ฒฝ์„ ํ†ตํ•œ ์ฝ”๋“œ ๊ฐ€๋…์„ฑ ํ–ฅ์ƒ

val posts = bookmarkRepository.findAllByUser(user)์—์„œ ๋ณ€์ˆ˜๋ช…์„ posts๋ผ๊ณ  ์ง€์ •ํ•˜์…จ๋Š”๋ฐ, ๋ฐ˜ํ™˜๋˜๋Š” ๊ฐ’์€ ๋ถ๋งˆํฌ์˜ ๋ฆฌ์ŠคํŠธ์ž…๋‹ˆ๋‹ค. ๋ณ€์ˆ˜๋ช…์„ bookmarks๋กœ ๋ณ€๊ฒฝํ•˜๋ฉด ์ฝ”๋“œ์˜ ๊ฐ€๋…์„ฑ์ด ํ–ฅ์ƒ๋ฉ๋‹ˆ๋‹ค.

์ ์šฉ ๊ฐ€๋Šฅํ•œ ์ˆ˜์ • ์‚ฌํ•ญ:

-fun queryBookmarkedSchool(): List<Int> {
-    val user = userFacade.currentUser() ?: throw UserNotFoundException
-
-    val posts = bookmarkRepository.findAllByUser(user)
-    return posts?.map { it.schoolId } ?: emptyList()
+fun queryBookmarkedSchool(): List<Int> {
+    val user = userFacade.currentUser() ?: throw UserNotFoundException()
+
+    val bookmarks = bookmarkRepository.findAllByUser(user)
+    return bookmarks?.map { it.schoolId } ?: emptyList()
}
๐Ÿ“œ Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

๐Ÿ“ฅ Commits

Files that changed from the base of the PR and between 5f035ca and c016579.

๐Ÿ“’ Files selected for processing (6)
  • src/main/kotlin/org/meogo/domain/bookmark/domain/Bookmark.kt (2 hunks)
  • src/main/kotlin/org/meogo/domain/bookmark/domain/BookmarkRepository.kt (1 hunks)
  • src/main/kotlin/org/meogo/domain/bookmark/exception/BookmarkNotFoundException.kt (1 hunks)
  • src/main/kotlin/org/meogo/domain/bookmark/presentation/BookmarkController.kt (1 hunks)
  • src/main/kotlin/org/meogo/domain/bookmark/service/BookmarkService.kt (3 hunks)
  • src/main/kotlin/org/meogo/global/error/exception/ErrorCode.kt (1 hunks)
๐Ÿ”‡ Additional comments (9)
src/main/kotlin/org/meogo/domain/bookmark/exception/BookmarkNotFoundException.kt (2)

1-1: ํŒจํ‚ค์ง€ ์„ ์–ธ์ด ์ ์ ˆํ•ฉ๋‹ˆ๋‹ค.

ํŒจํ‚ค์ง€ ์ด๋ฆ„์ด ํ‘œ์ค€ ๋ช…๋ช… ๊ทœ์น™์„ ๋”ฐ๋ฅด๊ณ  ์žˆ์œผ๋ฉฐ, ๋„๋ฉ”์ธ(bookmark)๊ณผ ํด๋ž˜์Šค ์œ ํ˜•(exception)์„ ์ •ํ™•ํžˆ ๋ฐ˜์˜ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.


3-4: ์ž„ํฌํŠธ ๋ฌธ์ด ์ ์ ˆํ•ฉ๋‹ˆ๋‹ค.

ํ•„์š”ํ•œ ํด๋ž˜์Šค๋“ค(ErrorCode์™€ MeogoException)๋งŒ ์ž„ํฌํŠธ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋Š” ํ”„๋กœ์ ํŠธ์— ์ž˜ ๊ตฌ์กฐํ™”๋œ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ ๋ฉ”์ปค๋‹ˆ์ฆ˜์ด ์žˆ์Œ์„ ์‹œ์‚ฌํ•ฉ๋‹ˆ๋‹ค.

src/main/kotlin/org/meogo/domain/bookmark/domain/BookmarkRepository.kt (2)

10-10: ๋ถ๋งˆํฌ ๊ฒ€์ƒ‰ ๊ธฐ๋Šฅ ๊ฐœ์„ ์„ ์Šน์ธํ•ฉ๋‹ˆ๋‹ค.

์ด ๋ณ€๊ฒฝ์€ ๋‹จ์ˆœํžˆ ์กด์žฌ ์—ฌ๋ถ€๋ฅผ ํ™•์ธํ•˜๋Š” ๋Œ€์‹  ์‹ค์ œ ๋ถ๋งˆํฌ ๊ฐ์ฒด๋ฅผ ๋ฐ˜ํ™˜ํ•จ์œผ๋กœ์จ ๊ธฐ๋Šฅ์„ ๊ฐœ์„ ํ•ฉ๋‹ˆ๋‹ค. ์ด๋Š” ๋” ๋งŽ์€ ์œ ์—ฐ์„ฑ์„ ์ œ๊ณตํ•˜๊ณ  ์ž ์žฌ์ ์œผ๋กœ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์ฟผ๋ฆฌ ์ˆ˜๋ฅผ ์ค„์ผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

nullable ๋ฐ˜ํ™˜ ํƒ€์ž… Bookmark?๋Š” ์ฃผ์–ด์ง„ ํ•™๊ต์™€ ์‚ฌ์šฉ์ž์— ๋Œ€ํ•œ ๋ถ๋งˆํฌ๊ฐ€ ์กด์žฌํ•˜์ง€ ์•Š์„ ์ˆ˜ ์žˆ์œผ๋ฏ€๋กœ ์ ์ ˆํ•ฉ๋‹ˆ๋‹ค.


12-12: ์กด์žฌ ํ™•์ธ ๋ฉ”์„œ๋“œ ์žฌ๋„์ž…์„ ์Šน์ธํ•˜์ง€๋งŒ, ์‚ญ์ œ ๊ธฐ๋Šฅ์— ๋Œ€ํ•ด ์งˆ๋ฌธ์ด ์žˆ์Šต๋‹ˆ๋‹ค.

existsBySchoolIdAndUser ๋ฉ”์„œ๋“œ์˜ ์žฌ๋„์ž…์€ ์ „์ฒด ๊ฐ์ฒด๋ฅผ ๊ฐ€์ ธ์˜ค์ง€ ์•Š๊ณ ๋„ ๋ถ๋งˆํฌ์˜ ์กด์žฌ ์—ฌ๋ถ€๋ฅผ ๋น ๋ฅด๊ฒŒ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด ์œ ์šฉํ•ฉ๋‹ˆ๋‹ค.

๊ทธ๋Ÿฌ๋‚˜ deleteBySchoolIdAndUser ๋ฉ”์„œ๋“œ๊ฐ€ ์ œ๊ฑฐ๋œ ๊ฒƒ์œผ๋กœ ๋ณด์ž…๋‹ˆ๋‹ค. ๋ถ๋งˆํฌ ์‚ญ์ œ ๊ธฐ๋Šฅ์ด ์—ฌ์ „ํžˆ ํ•„์š”ํ•œ์ง€, ๊ทธ๋ฆฌ๊ณ  ์ด ๊ธฐ๋Šฅ์ด ๋‹ค๋ฅธ ๊ณณ์œผ๋กœ ์ด๋™๋˜์—ˆ๋Š”์ง€ ํ™•์ธ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

๋‹ค์Œ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์‹คํ–‰ํ•˜์—ฌ ์‚ญ์ œ ๊ธฐ๋Šฅ์˜ ์กด์žฌ ์—ฌ๋ถ€๋ฅผ ํ™•์ธํ•ด ์ฃผ์„ธ์š”:

โœ… Verification successful

์กด์žฌ ํ™•์ธ ๋ฉ”์„œ๋“œ ์žฌ๋„์ž…์„ ์Šน์ธํ•ฉ๋‹ˆ๋‹ค. ์‚ญ์ œ ๊ธฐ๋Šฅ์€ ์„œ๋น„์Šค ๋ฐ ์ปจํŠธ๋กค๋Ÿฌ ๊ณ„์ธต์—์„œ ๊ณ„์† ์ œ๊ณต๋ฉ๋‹ˆ๋‹ค.

BookmarkService.kt ๋ฐ BookmarkController.kt์—์„œ ์‚ญ์ œ ๊ธฐ๋Šฅ์ด ๊ตฌํ˜„๋˜์–ด ์žˆ์–ด ๋ฆฌํฌ์ง€ํ† ๋ฆฌ์˜ deleteBySchoolIdAndUser ์ œ๊ฑฐ๋Š” ๋ฌธ์ œ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

๐Ÿ Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: ๋ถ๋งˆํฌ ์‚ญ์ œ ๊ธฐ๋Šฅ ํ™•์ธ

# Test: BookmarkRepository์—์„œ delete ๊ด€๋ จ ๋ฉ”์„œ๋“œ ๊ฒ€์ƒ‰
echo "BookmarkRepository์—์„œ delete ๊ด€๋ จ ๋ฉ”์„œ๋“œ ๊ฒ€์ƒ‰:"
rg --type kotlin "fun.*delete.*Bookmark" src/main/kotlin/org/meogo/domain/bookmark/

# Test: ๋‹ค๋ฅธ ํŒŒ์ผ์—์„œ ๋ถ๋งˆํฌ ์‚ญ์ œ ๋กœ์ง ๊ฒ€์ƒ‰
echo "\n๋‹ค๋ฅธ ํŒŒ์ผ์—์„œ ๋ถ๋งˆํฌ ์‚ญ์ œ ๋กœ์ง ๊ฒ€์ƒ‰:"
rg --type kotlin "delete.*[Bb]ookmark" src/main/kotlin/org/meogo/

Length of output: 754

src/main/kotlin/org/meogo/domain/bookmark/domain/Bookmark.kt (2)

15-15: schoolId ์†์„ฑ ๋ณ€๊ฒฝ์ด ์ ์ ˆํ•˜์ง€๋งŒ ๊ธฐ์กด ์ฝ”๋“œ์— ๋ฏธ์น˜๋Š” ์˜ํ–ฅ์„ ํ™•์ธํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

schoolId๋ฅผ non-nullable๋กœ ๋ณ€๊ฒฝํ•œ ๊ฒƒ์€ ์ข‹์€ ๊ฒฐ์ •์ž…๋‹ˆ๋‹ค. ์ด๋Š” Bookmark ์ธ์Šคํ„ด์Šค๊ฐ€ ํ•ญ์ƒ ์œ ํšจํ•œ schoolId๋ฅผ ๊ฐ€์ง€๋„๋ก ๋ณด์žฅํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ์ด ๋ณ€๊ฒฝ์œผ๋กœ ์ธํ•ด ๊ธฐ์กด ์ฝ”๋“œ์— ์˜ํ–ฅ์„ ์ค„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์‹คํ–‰ํ•˜์—ฌ Bookmark ํด๋ž˜์Šค์˜ ์‚ฌ์šฉ์„ ํ™•์ธํ•˜๊ณ  ํ•„์š”ํ•œ ๊ฒฝ์šฐ ์ˆ˜์ •ํ•˜์„ธ์š”:

#!/bin/bash
# Description: Verify usage of Bookmark class and potential impacts of schoolId change

# Test: Search for Bookmark class usage
rg --type kotlin "Bookmark\(" -A 5

1-1: ํŒจํ‚ค์ง€ ์„ ์–ธ ๋ณ€๊ฒฝ์ด ์ ์ ˆํ•ฉ๋‹ˆ๋‹ค.

๋„๋ฉ”์ธ ์—”ํ‹ฐํ‹ฐ๋ฅผ ๋ณ„๋„์˜ ํ•˜์œ„ ํŒจํ‚ค์ง€๋กœ ๋ถ„๋ฆฌํ•˜๋Š” ๊ฒƒ์€ ์ข‹์€ ๊ตฌ์กฐํ™” ๋ฐฉ์‹์ž…๋‹ˆ๋‹ค. ์ด๋Š” ์ฝ”๋“œ์˜ ์กฐ์ง๊ณผ ๊ฐ€๋…์„ฑ์„ ํ–ฅ์ƒ์‹œํ‚ต๋‹ˆ๋‹ค.

๋‹ค๋ฅธ ํŒŒ์ผ์—์„œ Bookmark ํด๋ž˜์Šค๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ณณ์˜ import ๋ฌธ์„ ํ™•์ธํ•˜๊ธฐ ์œ„ํ•ด ๋‹ค์Œ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์‹คํ–‰ํ•˜์„ธ์š”:

โœ… Verification successful

์ƒˆ ํŒจํ‚ค์ง€ ๊ฒฝ๋กœ์— ๋งž๊ฒŒ Bookmark ํด๋ž˜์Šค์˜ import ๋ฌธ์„ ์—…๋ฐ์ดํŠธํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

๋‹ค์Œ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์‹คํ–‰ํ•˜์—ฌ ๊ธฐ์กด์˜ ์ž˜๋ชป๋œ import ๋ฌธ์„ ํ™•์ธํ•˜์„ธ์š”:


ํŒจํ‚ค์ง€ ์„ ์–ธ ๋ณ€๊ฒฝ์ด ์ œ๋Œ€๋กœ ๋ฐ˜์˜๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

๋ชจ๋“  import ๋ฌธ์ด ์ƒˆ ํŒจํ‚ค์ง€ ๊ฒฝ๋กœ org.meogo.domain.bookmark.domain์„ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์–ด ์ถ”๊ฐ€ ์ˆ˜์ •์ด ํ•„์š”ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

๐Ÿ Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify import statements for Bookmark class

# Test: Search for import statements of Bookmark class
rg --type kotlin "import.*Bookmark"

Length of output: 1945


Script:

#!/bin/bash
# Description: Verify import statements for Bookmark class after package change

# Search for import statements of Bookmark class with the old package path
rg --type kotlin "import org\.meogo\.domain\.bookmark\.Bookmark"

Length of output: 66

src/main/kotlin/org/meogo/domain/bookmark/presentation/BookmarkController.kt (2)

1-11: ํŒจํ‚ค์ง€ ์„ ์–ธ ๋ฐ ์ž„ํฌํŠธ๊ฐ€ ์ ์ ˆํ•ฉ๋‹ˆ๋‹ค.

ํŒจํ‚ค์ง€ ์„ ์–ธ๊ณผ ์ž„ํฌํŠธ๊ฐ€ Spring Boot REST ์ปจํŠธ๋กค๋Ÿฌ์— ์ ํ•ฉํ•˜๊ฒŒ ์ž‘์„ฑ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ๋ถˆํ•„์š”ํ•œ ์ž„ํฌํŠธ๋Š” ์—†์œผ๋ฉฐ, ํ•„์š”ํ•œ ๋ชจ๋“  ํด๋ž˜์Šค๊ฐ€ ์ž„ํฌํŠธ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.


32-36: ๋ถ๋งˆํฌ ์‚ญ์ œ ๋ฉ”์„œ๋“œ๊ฐ€ ์ž˜ ๊ตฌํ˜„๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

DELETE ์š”์ฒญ์„ ์ฒ˜๋ฆฌํ•˜๋Š” ์—”๋“œํฌ์ธํŠธ๋กœ ์ ์ ˆํžˆ ๊ตฌํ˜„๋˜์—ˆ์Šต๋‹ˆ๋‹ค. @RequestParam์„ ์‚ฌ์šฉํ•˜์—ฌ school_id๋ฅผ ๋ฐ›์•„์˜ค๋Š” ๋ฐฉ์‹์ด ์˜ฌ๋ฐ”๋ฅด๋ฉฐ, @ResponseStatus(HttpStatus.NO_CONTENT)๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์‚ญ์ œ ์ž‘์—…์— ๋Œ€ํ•œ ์ ์ ˆํ•œ ์‘๋‹ต ์ƒํƒœ๋ฅผ ์ง€์ •ํ–ˆ์Šต๋‹ˆ๋‹ค.

๋ฉ”์„œ๋“œ์˜ ๊ตฌํ˜„์ด ๊ฐ„๊ฒฐํ•˜๊ณ  ๋ช…ํ™•ํ•ฉ๋‹ˆ๋‹ค. ์ข‹์€ ๊ตฌํ˜„์ž…๋‹ˆ๋‹ค.

src/main/kotlin/org/meogo/domain/bookmark/service/BookmarkService.kt (1)

1-1: ํŒจํ‚ค์ง€ ์ด๋™์— ๋”ฐ๋ฅธ ์ฐธ์กฐ ์—…๋ฐ์ดํŠธ ํ™•์ธ ํ•„์š”

ํด๋ž˜์Šค BookmarkService์˜ ํŒจํ‚ค์ง€๊ฐ€ org.meogo.domain.bookmark์—์„œ org.meogo.domain.bookmark.service๋กœ ๋ณ€๊ฒฝ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ์ด๋กœ ์ธํ•ด ์ด ํด๋ž˜์Šค๋ฅผ ์ฐธ์กฐํ•˜๋Š” ๋‹ค๋ฅธ ํŒŒ์ผ์˜ import ๋ฌธ์ด ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์—…๋ฐ์ดํŠธ๋˜์—ˆ๋Š”์ง€ ํ™•์ธํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

๋‹ค์Œ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์‹คํ–‰ํ•˜์—ฌ ์ด์ „ ํŒจํ‚ค์ง€ ๊ฒฝ๋กœ๋กœ BookmarkService๋ฅผ importํ•˜๋Š” ํŒŒ์ผ์ด ์žˆ๋Š”์ง€ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:

์ด ์Šคํฌ๋ฆฝํŠธ๋Š” ์ด์ „ ํŒจํ‚ค์ง€ ๊ฒฝ๋กœ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋ชจ๋“  ํŒŒ์ผ์„ ๋‚˜์—ดํ•ฉ๋‹ˆ๋‹ค. ๊ฒฐ๊ณผ๊ฐ€ ์—†๋‹ค๋ฉด ๋ชจ๋“  ์ฐธ์กฐ๊ฐ€ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์—…๋ฐ์ดํŠธ๋œ ๊ฒƒ์ž…๋‹ˆ๋‹ค.

โœ… Verification successful

๋ชจ๋“  ์ฐธ์กฐ๊ฐ€ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์—…๋ฐ์ดํŠธ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

๐Ÿ Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: ์ด์ „ ํŒจํ‚ค์ง€ ๊ฒฝ๋กœ๋กœ BookmarkService๋ฅผ importํ•˜๋Š” ํŒŒ์ผ ๊ฒ€์ƒ‰

# Test: ์ด์ „ ํŒจํ‚ค์ง€ ๊ฒฝ๋กœ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” import ๋ฌธ์ด ์žˆ๋Š” ํŒŒ์ผ ์ฐพ๊ธฐ
rg --type kotlin 'import org\.meogo\.domain\.bookmark\.BookmarkService' -l

Length of output: 76

val posts = bookmarkRepository.findAllBySchoolId(schoolId)
return posts?.size ?: 0
fun queryBookmarkedSchool(): List<Int> {
val user = userFacade.currentUser() ?: throw UserNotFoundException
Copy link

@coderabbitai coderabbitai bot Oct 2, 2024

Choose a reason for hiding this comment

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

โš ๏ธ Potential issue

์˜ˆ์™ธ ์ธ์Šคํ„ด์Šคํ™” ์‹œ ๊ด„ํ˜ธ ์ถ”๊ฐ€ ํ•„์š”

throw UserNotFoundException ๋Œ€์‹  throw UserNotFoundException()์ฒ˜๋Ÿผ ์˜ˆ์™ธ๋ฅผ ์ธ์Šคํ„ด์Šคํ™”ํ•  ๋•Œ ๊ด„ํ˜ธ๋ฅผ ์ถ”๊ฐ€ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

์ ์šฉ ๊ฐ€๋Šฅํ•œ ์ˆ˜์ • ์‚ฌํ•ญ:

-val user = userFacade.currentUser() ?: throw UserNotFoundException
+val user = userFacade.currentUser() ?: throw UserNotFoundException()
๐Ÿ“ Committable suggestion

โ€ผ๏ธ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
val user = userFacade.currentUser() ?: throw UserNotFoundException
val user = userFacade.currentUser() ?: throw UserNotFoundException()

Copy link
Member Author

Choose a reason for hiding this comment

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

UserNotFoundException๊ฐ€ object๋กœ ๋˜์–ด์žˆ์–ด์„œ ๊ดœ์ฐฎใ„ด์„ ๊ฒƒ ๊ฐ™์•„

Copy link

Choose a reason for hiding this comment

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

@meltapplee, ์•Œ๊ฒ ์Šต๋‹ˆ๋‹ค. UserNotFoundException์ด ๊ฐ์ฒด๋กœ ์ •์˜๋˜์–ด ์žˆ์–ด์„œ ๊ด„ํ˜ธ ์—†์ด๋„ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•˜๊ตฐ์š”. ์•Œ๋ ค์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค.

๐Ÿฐโ“


โœ๏ธ Learnings added
Learnt from: meltapplee
PR: MEOGO-DSM/MEOGO_Backend_V3#45
File: src/main/kotlin/org/meogo/domain/bookmark/service/BookmarkService.kt:32-32
Timestamp: 2024-10-03T12:41:49.733Z
Learning: UserNotFoundException is defined as an object, so it can be thrown without parentheses.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

@@ -37,6 +42,7 @@

fun deleteBookmark(schoolId: Int) {
val user = userFacade.currentUser() ?: throw UserNotFoundException
bookmarkRepository.deleteBySchoolIdAndUser(schoolId, user)
val bookmark = bookmarkRepository.findBySchoolIdAndUser(schoolId, user) ?: throw BookmarkNotFoundException
Copy link

Choose a reason for hiding this comment

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

โš ๏ธ Potential issue

์˜ˆ์™ธ ์ธ์Šคํ„ด์Šคํ™” ์‹œ ๊ด„ํ˜ธ ์ถ”๊ฐ€ ํ•„์š”

throw BookmarkNotFoundException ๋Œ€์‹  throw BookmarkNotFoundException()์ฒ˜๋Ÿผ ์˜ˆ์™ธ๋ฅผ ์ธ์Šคํ„ด์Šคํ™”ํ•  ๋•Œ ๊ด„ํ˜ธ๋ฅผ ์ถ”๊ฐ€ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

์ ์šฉ ๊ฐ€๋Šฅํ•œ ์ˆ˜์ • ์‚ฌํ•ญ:

-val bookmark = bookmarkRepository.findBySchoolIdAndUser(schoolId, user) ?: throw BookmarkNotFoundException
+val bookmark = bookmarkRepository.findBySchoolIdAndUser(schoolId, user) ?: throw BookmarkNotFoundException()
๐Ÿ“ Committable suggestion

โ€ผ๏ธ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
val bookmark = bookmarkRepository.findBySchoolIdAndUser(schoolId, user) ?: throw BookmarkNotFoundException
val bookmark = bookmarkRepository.findBySchoolIdAndUser(schoolId, user) ?: throw BookmarkNotFoundException()

@meltapplee meltapplee merged commit d887bbb into main Oct 3, 2024
2 checks passed
@meltapplee meltapplee deleted the 44-bookmark branch October 3, 2024 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant