Skip to content

Conversation

@sweatbuckets
Copy link
Contributor

@sweatbuckets sweatbuckets commented Dec 30, 2025

  1. #⃣ 연관된 이슈
    • 관련 이슈를 명시해주세요.
    • 예: #이슈번호#이슈번호
  2. 📝 작업 내용
    • 이번 PR에서 작업한 내용을 간략히 설명해주세요.
    • 필요한 경우 이미지 첨부 가능.
  3. 📸 스크린샷 (선택)
    • 작업 내용을 시각적으로 표현할 스크린샷을 포함하세요.
  4. 💬 리뷰 요구사항 (선택)
    • 리뷰어가 특히 검토해주었으면 하는 부분이 있다면 작성해주세요.
    • 예: "메서드 XXX의 이름을 더 명확히 하고 싶은데, 좋은 아이디어가 있으신가요?"

Summary by CodeRabbit

  • Bug Fixes

    • Dashboard now shows all 24 hours of visitor metrics with zero counts for inactive hours.
    • Visit response now uses numeric hour values for hourly entries (hour represented as an integer).
  • Refactor

    • Photo album cover image loading batched and optimized for more reliable and efficient image resolution.

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

정윤호 added 3 commits December 30, 2025 00:04
# Conflicts:
#	src/main/java/cc/backend/photoAlbum/service/PhotoAlbumServiceImpl.java
@coderabbitai
Copy link

coderabbitai bot commented Dec 30, 2025

📝 Walkthrough

Walkthrough

Replaced hour-row direct mapping with a 24-hour accumulation and sort for hourly visitor counts; updated an image field comment to use "casting"; refactored photo-album image resolution to batch-fetch images and map presigned-URL DTOs centrally.

Changes

Cohort / File(s) Change Summary
Hourly Data Aggregation
src/main/java/cc/backend/admin/dashboard/service/DashboardService.java
Replaced direct stream mapping with two-phase accumulation: initialize 0–23 hour map, populate from query rows, then sort and convert to HourlyVisitorDTO to ensure all hours are present.
Entity Documentation
src/main/java/cc/backend/image/entity/Image.java
Updated inline comment for imageUrl from "poster, notice, actor 이미지 전용" to "poster, notice, casting 이미지 전용"; no behavioral or API changes.
Album Image Resolution
src/main/java/cc/backend/photoAlbum/service/PhotoAlbumServiceImpl.java
Batched and centralized image resolution: build albumImageMap with a merge (de-duplicate), collect images and call imageService.getImages() to produce imageDtoMap, guard for empty maps, and source cover DTOs from the batched map instead of per-album on-the-fly logic.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐰 I hopped through hours, filled each one with light,
Zeroes tucked in pockets for the quiet night,
I gathered album photos, batched them with a grin,
Sprinkled presigned links — off they leap and spin,
Casting says hello where actors danced within. 🥕✨

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is completely empty of actual content—only the template placeholders are present with no concrete details about issues, work summary, or implementation specifics filled in. Fill in the template sections with concrete details: specify related issue numbers, summarize the actual work performed (e.g., why 24-hour initialization was needed), and note the data type change in VisitResponseDTO.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding logic to fill hourly time slots with zero visitors, which aligns with the DashboardService modifications initializing a 24-hour map.
✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4a36495 and 4d6a6f8.

📒 Files selected for processing (1)
  • src/main/java/cc/backend/admin/dashboard/dto/VisitResponseDTO.java
🔇 Additional comments (1)
src/main/java/cc/backend/admin/dashboard/dto/VisitResponseDTO.java (1)

11-11: Type change from String to int is correct and properly implemented.

The hour field type change is semantically appropriate for representing hours (0-23) and is already fully aligned with the DashboardService implementation, which uses Map<Integer, Long> and populates all 24 hours via IntStream.range(0, 24).

Note that this changes the JSON API contract: hours will now serialize as numbers instead of strings ("hour": 1 instead of "hour": "01"). Ensure external API consumers that parse this response are aware of this format change.


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

🧹 Nitpick comments (1)
src/main/java/cc/backend/photoAlbum/service/PhotoAlbumServiceImpl.java (1)

355-375: Consider batching image resolution for consistency.

This helper method iterates and calls imageService.getImages(List.of(img), ...) per image, which could be refactored to batch all images in one call, similar to the approach used in getPhotoAlbumList (lines 151-163). This would improve performance and maintain consistency across the codebase.

🔎 Proposed refactor
     private Map<Long, String> getFirstImageMapForPhotoAlbums(List<Long> albumIds) {
         if (albumIds == null || albumIds.isEmpty()) {
             return Collections.emptyMap();
         }

         // 배치로 대표 이미지 조회
         List<Image> firstImages =
                 imageRepository.findFirstByContentIds(albumIds, FilePath.photoAlbum);

-        Map<Long, String> result = new HashMap<>();
-
-        for (Image img : firstImages) {
-            String presignedUrl = imageService
-                    .getImages(List.of(img), img.getMemberId())
-                    .get(0)
-                    .getPresignedUrl();
-
-            result.put(img.getContentId(), presignedUrl);
-        }
-        return result;
+        if (firstImages.isEmpty()) {
+            return Collections.emptyMap();
+        }
+
+        // Batch fetch presigned URLs
+        Long memberId = firstImages.get(0).getMemberId();
+        return imageService.getImages(firstImages, memberId)
+                .stream()
+                .collect(Collectors.toMap(
+                        ImageResponseDTO.ImageResultWithPresignedUrlDTO::getContentId,
+                        ImageResponseDTO.ImageResultWithPresignedUrlDTO::getPresignedUrl,
+                        (a, b) -> a
+                ));
     }

Note: The proposed refactor assumes all images share the same memberId for authorization purposes. Verify this assumption holds for your use case.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d80a12c and 4a36495.

📒 Files selected for processing (3)
  • src/main/java/cc/backend/admin/dashboard/service/DashboardService.java
  • src/main/java/cc/backend/image/entity/Image.java
  • src/main/java/cc/backend/photoAlbum/service/PhotoAlbumServiceImpl.java
🧰 Additional context used
🧬 Code graph analysis (1)
src/main/java/cc/backend/photoAlbum/service/PhotoAlbumServiceImpl.java (2)
src/main/java/cc/backend/image/DTO/ImageResponseDTO.java (1)
  • ImageResponseDTO (11-38)
src/main/java/cc/backend/photoAlbum/dto/PhotoAlbumResponseDTO.java (1)
  • PhotoAlbumResponseDTO (11-89)
🪛 GitHub Actions: CI/CD with Blue-Green Deployment
src/main/java/cc/backend/admin/dashboard/service/DashboardService.java

[error] 55-55: incompatible types: Integer cannot be converted to String


[error] 56-56: incompatible types: List cannot be converted to List

🔇 Additional comments (5)
src/main/java/cc/backend/image/entity/Image.java (1)

35-35: LGTM!

The comment terminology update from "actor" to "casting" aligns with the domain model naming conventions.

src/main/java/cc/backend/admin/dashboard/service/DashboardService.java (1)

43-51: LGTM on the 24-hour map initialization logic.

The approach of pre-populating all 24 hours with zeros and then overwriting with actual data ensures consistent output regardless of which hours have visitor data. The sort operation ensures proper ordering.

src/main/java/cc/backend/photoAlbum/service/PhotoAlbumServiceImpl.java (3)

140-148: LGTM on batched image fetching.

The merge function (a, b) -> a is a good defensive measure to handle potential duplicate contentIds, ensuring deterministic behavior by keeping the first encountered image.


151-163: Good performance improvement with batched presigned URL generation.

The ternary guard for empty albumImageMap avoids an unnecessary service call, and batching all images into a single getImages call reduces N+1 query overhead.


166-178: Verify null handling for albums without images.

imageDtoMap.get(album.getId()) will return null if an album has no associated images. Confirm this is the intended behavior and that the frontend/consumers handle null for imageResultWithPresignedUrlDTO gracefully.

@sweatbuckets sweatbuckets merged commit d3501a5 into develop Dec 30, 2025
2 checks passed
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.

2 participants