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-55) modify review picture response #56

Merged
merged 3 commits into from
Nov 21, 2024

Conversation

meltapplee
Copy link
Member

@meltapplee meltapplee commented Nov 20, 2024

close #55
스크란샷 2024-11-20 23 47 30

Summary by CodeRabbit

  • μƒˆλ‘œμš΄ κΈ°λŠ₯

    • 리뷰 μ‘λ‹΅μ—μ„œ 이미지 속성이 단일 λ¬Έμžμ—΄μ—μ„œ λ¬Έμžμ—΄ λͺ©λ‘μœΌλ‘œ λ³€κ²½λ˜μ–΄ μ—¬λŸ¬ 이미지λ₯Ό μ§€μ›ν•©λ‹ˆλ‹€.
    • 리뷰 사진 쿼리 둜직이 κ°œμ„ λ˜μ–΄ μ—°λ„λ³„λ‘œ κ·Έλ£Ήν™”λœ 이미지 URL λͺ©λ‘μ„ λ°˜ν™˜ν•©λ‹ˆλ‹€.
    • 파일 μ—…λ‘œλ“œλ₯Ό μœ„ν•œ 검증 ν”„λ‘œμ„ΈμŠ€μ— "webp" 파일 ν™•μž₯μžκ°€ μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€.
  • 버그 μˆ˜μ •

    • μ—†μŒ
  • λ¬Έμ„œν™”

    • μ—†μŒ
  • λ¦¬νŒ©ν„°λ§

    • μ—†μŒ
  • μŠ€νƒ€μΌ

    • μ—†μŒ
  • ν…ŒμŠ€νŠΈ

    • μ—†μŒ
  • 작일

    • μ—†μŒ
  • 되돌리기

    • μ—†μŒ

@meltapplee meltapplee self-assigned this Nov 20, 2024
Copy link

coderabbitai bot commented Nov 20, 2024

Walkthrough

이 Pull Requestμ—μ„œλŠ” ReviewPictureResponse 데이터 클래슀의 image 속성이 단일 String νƒ€μž…μ—μ„œ List<String> νƒ€μž…μœΌλ‘œ λ³€κ²½λ˜μ—ˆμŠ΅λ‹ˆλ‹€. 이 변경은 응닡 κ΅¬μ‘°μ—μ„œ 단일 이미지λ₯Ό λ‚˜νƒ€λ‚΄λŠ” λŒ€μ‹  μ—¬λŸ¬ 이미지λ₯Ό μˆ˜μš©ν•˜λ„λ‘ μˆ˜μ •λ˜μ—ˆμŠ΅λ‹ˆλ‹€. λ˜ν•œ, QueryReviewPictureService 클래슀의 queryReviewPicture ν•¨μˆ˜λŠ” 리뷰λ₯Ό μ²˜λ¦¬ν•˜λŠ” 둜직이 λ³€κ²½λ˜μ–΄, μ—°λ„λ³„λ‘œ κ·Έλ£Ήν™”λœ 이미지 URL λͺ©λ‘μ„ μƒμ„±ν•˜κ³  이λ₯Ό 기반으둜 ReviewPictureResponse 객체λ₯Ό λ°˜ν™˜ν•©λ‹ˆλ‹€. λ§ˆμ§€λ§‰μœΌλ‘œ, FileUtil 클래슀의 verificationFile λ©”μ„œλ“œλŠ” ν—ˆμš©λ˜λŠ” 파일 ν™•μž₯자 λͺ©λ‘μ— "webp"λ₯Ό μΆ”κ°€ν•˜μ—¬ 파일 검증 κΈ°λŠ₯을 ν™•μž₯ν–ˆμŠ΅λ‹ˆλ‹€.

Changes

파일 경둜 λ³€κ²½ μš”μ•½
src/main/kotlin/org/meogo/domain/review/presentation/dto/response/ReviewPictureResponse.kt ReviewPictureResponse 클래슀의 image 속성이 Stringμ—μ„œ List<String>으둜 변경됨.
src/main/kotlin/org/meogo/domain/review/service/QueryReviewPictureService.kt queryReviewPicture ν•¨μˆ˜μ˜ 둜직이 μˆ˜μ •λ˜μ–΄ μ—°λ„λ³„λ‘œ κ·Έλ£Ήν™”λœ 이미지 URL λͺ©λ‘μ„ μƒμ„±ν•˜μ—¬ ReviewPictureResponse 객체λ₯Ό λ°˜ν™˜ν•¨.
src/main/kotlin/org/meogo/global/s3/FileUtil.kt verificationFile λ©”μ„œλ“œμ— "webp" ν™•μž₯μžκ°€ μΆ”κ°€λ˜μ–΄ ν—ˆμš©λ˜λŠ” 파일 ν™•μž₯자 λͺ©λ‘μ΄ ν™•μž₯됨.

Possibly related PRs

  • πŸ„ :: (Meogo-18) query review picsΒ #19: ReviewPictureResponse.ktμ—μ„œμ˜ λ³€κ²½ 사항은 PR #19의 ReviewPictureResponse 클래슀 μˆ˜μ •κ³Ό 관련이 있으며, 두 PR λͺ¨λ‘ image μ†μ„±μ˜ 변경을 ν¬ν•¨ν•˜κ³  μžˆμ–΄ 데이터 ꡬ쑰에 직접적인 연결이 μžˆμŠ΅λ‹ˆλ‹€.

Suggested labels

κΈ°λŠ₯개발

πŸ‡ "λ³€κ²½λœ 이미지듀, μ΄μ œλŠ” λ§Žμ•„μš”,
μ—¬λŸ¬ μž₯의 사진, 기쁜 μ†Œμ‹μ΄μ£ .
μ—°λ„λ³„λ‘œ μ •λ¦¬λœ 리뷰의 ν–₯μ—°,
μ›Ήμ—μ„œ λ§Œλ‚˜λŠ” μƒˆλ‘œμš΄ νŒŒμΌλ„,
λͺ¨λ‘ ν•¨κ»˜ 즐길 수 μžˆλ‹΅λ‹ˆλ‹€,
우리 λͺ¨λ‘μ˜ μ†Œμ€‘ν•œ μˆœκ°„λ“€!" πŸŽ‰


πŸ“œ Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 1193e70 and 6bfc5fa.

πŸ“’ Files selected for processing (1)
  • src/main/kotlin/org/meogo/domain/review/service/QueryReviewPictureService.kt (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/kotlin/org/meogo/domain/review/service/QueryReviewPictureService.kt

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: 1

🧹 Outside diff range and nitpick comments (4)
src/main/kotlin/org/meogo/domain/review/presentation/dto/response/ReviewPictureResponse.kt (1)

4-6: API 변경사항에 λŒ€ν•œ λ¬Έμ„œν™” μ œμ•ˆ

μ΄λŸ¬ν•œ μ£Όμš” 변경사항은 API λ¬Έμ„œμ— λͺ…ν™•νžˆ κΈ°λ‘λ˜μ–΄μ•Ό ν•©λ‹ˆλ‹€.

λ‹€μŒκ³Ό 같은 λ¬Έμ„œν™”λ₯Ό μ œμ•ˆλ“œλ¦½λ‹ˆλ‹€:

 data class ReviewPictureResponse(
+    /** 리뷰 μ΄λ―Έμ§€μ˜ 연도 */
     val year: Int,
+    /** ν•΄λ‹Ή μ—°λ„μ˜ 리뷰 이미지 URL λͺ©λ‘ */
     val image: List<String>
 )
src/main/kotlin/org/meogo/domain/review/service/QueryReviewPictureService.kt (1)

20-28: μ½”λ“œ 가독성 κ°œμ„ μ΄ ν•„μš”ν•©λ‹ˆλ‹€

ν˜„μž¬ μ½”λ“œλŠ” κΈ°λŠ₯μ μœΌλ‘œλŠ” μ •ν™•ν•˜λ‚˜, λ‹€μŒκ³Ό 같은 κ°œμ„ μ‚¬ν•­μ„ μ œμ•ˆν•©λ‹ˆλ‹€:

  1. URL 생성 λ‘œμ§μ„ 별도 ν•¨μˆ˜λ‘œ μΆ”μΆœ
  2. λ³΅μž‘ν•œ λ³€ν™˜ λ‘œμ§μ— λŒ€ν•œ 주석 μΆ”κ°€
+    private fun generatePictureUrlPairs(review: Review): List<Pair<Int, String>> {
+        return review.picture?.split(",")?.map { pic ->
+            val imgUrl = fileUtil.generateObjectUrl(pic.trim(), Path.REVIEW)
+            Pair(review.date.year, imgUrl)
+        } ?: emptyList()
+    }
+
     @Transactional
     fun queryReviewPicture(schoolId: Int): List<ReviewPictureResponse> {
         val reviews = reviewRepository.findAllBySchoolId(schoolId)?.sortedByDescending { it.id } ?: return emptyList()
-        val picturesByYear = reviews
-            .flatMap { review ->
-                val year = review.date.year
-                review.picture?.split(",")?.map { pic ->
-                    val imgUrl = fileUtil.generateObjectUrl(pic.trim(), Path.REVIEW)
-                    Pair(year, imgUrl)
-                } ?: emptyList()
-            }
-            .groupBy { it.first }
+        // 리뷰 데이터λ₯Ό 연도별 이미지 URL둜 λ³€ν™˜ν•˜κ³  κ·Έλ£Ήν™”
+        val picturesByYear = reviews
+            .flatMap { generatePictureUrlPairs(it) }
+            .groupBy { it.first }
src/main/kotlin/org/meogo/global/s3/FileUtil.kt (2)

75-77: 파일 검증 둜직 κ°œμ„ μ΄ ν•„μš”ν•©λ‹ˆλ‹€

ν˜„μž¬ κ΅¬ν˜„μ€ "webp" ν™•μž₯자λ₯Ό μΆ”κ°€ν•œ 것은 쒋은 λ³€κ²½μ΄μ§€λ§Œ, λ‹€μŒκ³Ό 같은 κ°œμ„ μ‚¬ν•­μ„ μ œμ•ˆλ“œλ¦½λ‹ˆλ‹€:

  1. ν—ˆμš©λœ ν™•μž₯자λ₯Ό μƒμˆ˜λ‘œ λΆ„λ¦¬ν•˜μ—¬ 관리
  2. ꡬ체적인 μ˜ˆμ™Έ 클래슀 μ‚¬μš©
  3. 파일 크기 μ œν•œ μΆ”κ°€
  4. MIME νƒ€μž… 검증 μΆ”κ°€

λ‹€μŒκ³Ό 같이 κ°œμ„ ν•˜λŠ” 것을 μΆ”μ²œλ“œλ¦½λ‹ˆλ‹€:

+ companion object {
+     const val EXP_TIME = 1000 * 60 * 60 * 1
+     private val ALLOWED_EXTENSIONS = setOf("jpg", "jpeg", "png", "heic", "hwp", "pptx", "webp")
+     private const val MAX_FILE_SIZE = 10 * 1024 * 1024 // 10MB
+ }

  private fun verificationFile(file: MultipartFile): String {
      if (file.isEmpty || file.originalFilename == null) {
-         throw NullPointerException()
+         throw IllegalArgumentException("파일이 λΉ„μ–΄μžˆκ±°λ‚˜ 파일λͺ…이 μ—†μŠ΅λ‹ˆλ‹€")
+     }
+     
+     if (file.size > MAX_FILE_SIZE) {
+         throw IllegalArgumentException("파일 ν¬κΈ°λŠ” 10MBλ₯Ό μ΄ˆκ³Όν•  수 μ—†μŠ΅λ‹ˆλ‹€")
      }

      val originalFilename = file.originalFilename!!
      val ext = originalFilename.substring(originalFilename.lastIndexOf(".") + 1).lowercase(Locale.getDefault())

-     if (!(ext == "jpg" || ext == "jpeg" || ext == "png" || ext == "heic" || ext == "hwp" || ext == "pptx" || ext == "webp")) {
-         throw Exception()
+     if (!ALLOWED_EXTENSIONS.contains(ext)) {
+         throw IllegalArgumentException("μ§€μ›ν•˜μ§€ μ•ŠλŠ” 파일 ν˜•μ‹μž…λ‹ˆλ‹€: $ext")
      }

+     // MIME νƒ€μž… 검증
+     val contentType = file.contentType
+     if (contentType == null || !contentType.startsWith("image/")) {
+         throw IllegalArgumentException("μœ νš¨ν•˜μ§€ μ•Šμ€ 이미지 νŒŒμΌμž…λ‹ˆλ‹€")
+     }

      return ext
  }
🧰 Tools
πŸͺ› detekt

[warning] 76-76: A call to the default constructor of an exception was detected. Instead one of the constructor overloads should be called. This allows to provide more meaningful exceptions.

(detekt.exceptions.ThrowingExceptionsWithoutMessageOrCause)


Line range hint 29-44: λ³΄μ•ˆ κ°œμ„ μ‚¬ν•­ κ²€ν† κ°€ ν•„μš”ν•©λ‹ˆλ‹€

파일 μ—…λ‘œλ“œ κΈ°λŠ₯에 λ‹€μŒκ³Ό 같은 λ³΄μ•ˆ κ°œμ„ μ΄ ν•„μš”ν•©λ‹ˆλ‹€:

  1. 파일λͺ… 검증 및 μ‚΄κ·  처리
  2. URL 생성 μš”μ²­μ— λŒ€ν•œ 속도 μ œν•œ

λ‹€μŒκ³Ό 같은 λ³΄μ•ˆ κΈ°λŠ₯ μΆ”κ°€λ₯Ό κ³ λ €ν•΄μ£Όμ„Έμš”:

  1. 파일λͺ… 검증을 μœ„ν•œ μœ ν‹Έλ¦¬ν‹° ν•¨μˆ˜ μΆ”κ°€
  2. Rate Limiter κ΅¬ν˜„ (예: Redis 기반)
  3. μ•…μ„± 파일 검사

ν•„μš”ν•˜μ‹œλ‹€λ©΄ λ³΄μ•ˆ κ°œμ„ μ„ μœ„ν•œ 상세 κ΅¬ν˜„ μ˜ˆμ‹œλ₯Ό μ œκ³΅ν•΄λ“œλ¦΄ 수 μžˆμŠ΅λ‹ˆλ‹€.

🧰 Tools
πŸͺ› detekt

[warning] 76-76: A call to the default constructor of an exception was detected. Instead one of the constructor overloads should be called. This allows to provide more meaningful exceptions.

(detekt.exceptions.ThrowingExceptionsWithoutMessageOrCause)

πŸ“œ Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between f114e8a and 1193e70.

πŸ“’ Files selected for processing (3)
  • src/main/kotlin/org/meogo/domain/review/presentation/dto/response/ReviewPictureResponse.kt (1 hunks)
  • src/main/kotlin/org/meogo/domain/review/service/QueryReviewPictureService.kt (1 hunks)
  • src/main/kotlin/org/meogo/global/s3/FileUtil.kt (1 hunks)
πŸ”‡ Additional comments (3)
src/main/kotlin/org/meogo/domain/review/presentation/dto/response/ReviewPictureResponse.kt (1)

4-6: ⚠️ Potential issue

λ³€κ²½λœ 응닡 ꡬ쑰의 영ν–₯ 확인 ν•„μš”

image ν•„λ“œκ°€ 단일 λ¬Έμžμ—΄μ—μ„œ λ¬Έμžμ—΄ 리슀트둜 λ³€κ²½λ˜μ–΄ API 응닡 ꡬ쑰가 λ³€κ²½λ˜μ—ˆμŠ΅λ‹ˆλ‹€. μ΄λŠ” APIλ₯Ό μ‚¬μš©ν•˜λŠ” ν΄λΌμ΄μ–ΈνŠΈ 츑에 영ν–₯을 λ―ΈμΉ  수 μžˆλŠ” μ£Όμš” λ³€κ²½μ‚¬ν•­μž…λ‹ˆλ‹€.

λ‹€μŒ 슀크립트λ₯Ό μ‹€ν–‰ν•˜μ—¬ κ΄€λ ¨ μ„œλΉ„μŠ€λ“€μ΄ 이 변경사항을 μ˜¬λ°”λ₯΄κ²Œ μ²˜λ¦¬ν•˜λŠ”μ§€ ν™•μΈν•˜κ² μŠ΅λ‹ˆλ‹€:

βœ… Verification successful

Let me check the implementation of QueryReviewPictureService to verify how it handles the change:


API 응닡 ꡬ쑰 변경이 μ•ˆμ „ν•˜κ²Œ μ²˜λ¦¬λ˜μ—ˆμŒμ„ ν™•μΈν–ˆμŠ΅λ‹ˆλ‹€

QueryReviewPictureService의 κ΅¬ν˜„μ„ κ²€ν† ν•œ κ²°κ³Ό, λ‹€μŒκ³Ό 같이 변경사항이 μ˜¬λ°”λ₯΄κ²Œ 처리되고 μžˆμŠ΅λ‹ˆλ‹€:

  • μ„œλΉ„μŠ€ κ³„μΈ΅μ—μ„œ urls.map { it.second }λ₯Ό 톡해 List ν˜•νƒœλ‘œ 적절히 λ³€ν™˜ν•˜μ—¬ 응닡
  • 데이터 λ³€ν™˜ 둜직이 μΌκ΄€λ˜κ²Œ 적용됨
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: ReviewPictureResponse μ‚¬μš© ν˜„ν™© 확인

# ReviewPictureResponseλ₯Ό μ‚¬μš©ν•˜λŠ” μ„œλΉ„μŠ€ 및 컨트둀러 검색
echo "=== ReviewPictureResponse μ‚¬μš© ν˜„ν™© ==="
rg -l "ReviewPictureResponse" src/main/kotlin/org/meogo/domain/review/

# 이미지 처리 κ΄€λ ¨ 둜직 검색
echo -e "\n=== 이미지 처리 둜직 검색 ==="
ast-grep --pattern 'fun $_ ($$$) {
  $$$
  ReviewPictureResponse($$$)
  $$$
}'

Length of output: 457


Script:

#!/bin/bash
# QueryReviewPictureService κ΅¬ν˜„ 확인
echo "=== QueryReviewPictureService κ΅¬ν˜„ ==="
rg -A 10 "class QueryReviewPictureService" src/main/kotlin/org/meogo/domain/review/service/QueryReviewPictureService.kt

# ReviewPictureResponse 생성 둜직 확인
echo -e "\n=== ReviewPictureResponse 생성 둜직 ==="
rg -B 2 -A 5 "ReviewPictureResponse" src/main/kotlin/org/meogo/domain/review/service/QueryReviewPictureService.kt

Length of output: 1642

src/main/kotlin/org/meogo/domain/review/service/QueryReviewPictureService.kt (2)

30-32: 응닡 λ³€ν™˜ 둜직이 μ μ ˆν•©λ‹ˆλ‹€

μ—°λ„λ³„λ‘œ κ·Έλ£Ήν™”λœ 데이터λ₯Ό ReviewPictureResponse둜 λ³€ν™˜ν•˜λŠ” 둜직이 κΉ”λ”ν•˜κ³  λͺ…ν™•ν•©λ‹ˆλ‹€.


20-32: 응닡 ꡬ쑰 변경에 λ”°λ₯Έ 영ν–₯도 확인이 ν•„μš”ν•©λ‹ˆλ‹€

단일 μ΄λ―Έμ§€μ—μ„œ 닀쀑 이미지 μ‘λ‹΅μœΌλ‘œμ˜ 변경은 API μ†ŒλΉ„μžμ—κ²Œ 영ν–₯을 쀄 수 μžˆμŠ΅λ‹ˆλ‹€.

βœ… Verification successful

Let me gather more information about the response type and its usage.


Let me try one more search to find any API endpoints and tests.


Let me try one final search focusing on the controller and API endpoints.


Let me check the ReviewController content to see how the endpoint is exposed.


API 응닡 ꡬ쑰 변경은 μ•ˆμ „ν•©λ‹ˆλ‹€

리뷰 사진 쑰회 API(GET /review/pic)λŠ” μƒˆλ‘œ μΆ”κ°€λœ μ—”λ“œν¬μΈνŠΈμ΄λ©°, κΈ°μ‘΄ APIλ₯Ό μˆ˜μ •ν•œ 것이 μ•„λ‹™λ‹ˆλ‹€. 응닡 νƒ€μž…μΈ ReviewPictureResponse도 μƒˆλ‘œ μ •μ˜λœ DTOμž…λ‹ˆλ‹€. λ”°λΌμ„œ κΈ°μ‘΄ μ½”λ“œμ— 영ν–₯을 주지 μ•ŠμœΌλ©° ν•˜μœ„ ν˜Έν™˜μ„± λ¬Έμ œκ°€ λ°œμƒν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# API 응닡 ꡬ쑰λ₯Ό μ‚¬μš©ν•˜λŠ” ν”„λ‘ νŠΈμ—”λ“œ μ½”λ“œ 검색
rg -t typescript -t javascript "ReviewPictureResponse" 

# 응닡 νƒ€μž…μ„ μ°Έμ‘°ν•˜λŠ” λ‹€λ₯Έ λ°±μ—”λ“œ μ½”λ“œ 검색
rg "ReviewPictureResponse"

Length of output: 688


Script:

#!/bin/bash
# Check the response type definition
cat src/main/kotlin/org/meogo/domain/review/presentation/dto/response/ReviewPictureResponse.kt

# Look for API endpoints using this response
ast-grep --pattern 'fun $FUNC($$$): $RET<$$$ReviewPictureResponse$$$>'

# Search for any tests using this response type
rg -g "**/*Test*" "ReviewPictureResponse"

Length of output: 502


Script:

#!/bin/bash
# Look for controller endpoints
rg -A 5 "@.*Mapping.*ReviewPicture"

# Search for tests with correct glob pattern
rg --glob "*Test*.kt" "ReviewPictureResponse"

# Find any references to review pictures in frontend code
rg -g "*.{js,jsx,ts,tsx}" "review.*picture"

Length of output: 427


Script:

#!/bin/bash
# Find the controller class that uses this service
rg -l "class.*Review.*Controller"

# Look for any REST controller annotations
rg "@RestController" -A 3 -g "*.kt"

# Find the endpoint that returns ReviewPictureResponse
ast-grep --pattern 'class $CLASS {
  $$$
  fun $FUNC($$$): List<ReviewPictureResponse> {
    $$$
  }
  $$$
}'

Length of output: 3941


Script:

#!/bin/bash
# Check the ReviewController implementation
cat src/main/kotlin/org/meogo/domain/review/presentation/ReviewController.kt

# Look for any client-side code in common web directories
fd -g "*.{js,jsx,ts,tsx}" -d 3 src/main/resources/static
fd -g "*.{js,jsx,ts,tsx}" -d 3 frontend

Length of output: 4288

@@ -16,16 +16,19 @@ class QueryReviewPictureService(
@Transactional
fun queryReviewPicture(schoolId: Int): List<ReviewPictureResponse> {
val reviews = reviewRepository.findAllBySchoolId(schoolId)?.sortedByDescending { it.id } ?: return emptyList()

val pictures = reviews
println(reviews)
Copy link

Choose a reason for hiding this comment

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

πŸ› οΈ Refactor suggestion

println λŒ€μ‹  λ‘œκΉ… ν”„λ ˆμž„μ›Œν¬λ₯Ό μ‚¬μš©ν•˜μ„Έμš”

디버깅을 μœ„ν•œ println 문은 ν”„λ‘œλ•μ…˜ μ½”λ“œμ— μ ν•©ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€. SLF4Jλ‚˜ Log4j와 같은 μ μ ˆν•œ λ‘œκΉ… ν”„λ ˆμž„μ›Œν¬λ₯Ό μ‚¬μš©ν•˜μ„Έμš”.

-println(reviews)
+log.debug("Retrieved reviews: {}", reviews)

Committable suggestion skipped: line range outside the PR's diff.

@meltapplee meltapplee merged commit 55d37c8 into main Nov 21, 2024
2 checks passed
@meltapplee meltapplee deleted the 55-modify-review-picture-response branch November 21, 2024 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

리뷰 사진 λ°˜ν™˜ ν˜•μ‹ λ³€κ²½
1 participant