Feat/#126 타임라인 - 타임라인 수정, 조회 구현#134
Conversation
# Conflicts: # src/main/java/com/whereyouad/WhereYouAd/domains/timeline/domain/service/TimelineServiceImpl.java # src/main/java/com/whereyouad/WhereYouAd/domains/timeline/presentation/docs/TimelineControllerDocs.java
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
Walkthrough타임라인 요약/상세 조회와 수정 API를 추가하고, MetricFact를 조회해 일별 지표 추이와 플랫폼 기여도를 계산하는 로직(집계·ROAS 계산·기여율 산정)을 구현했습니다. 권한 예외 코드를 세분화하고 관련 DTO/변환/컨트롤러/저장소를 확장했습니다. ChangesTimeline 조회 및 수정 기능
Sequence Diagram(s)sequenceDiagram
participant User as 사용자
participant Controller as TimelineController
participant Service as TimelineServiceImpl
participant Repo as MetricFactRepository
participant Conv as TimelineConverter
User->>Controller: GET /api/org/{orgId}/timeline/{timelineId}
Controller->>Service: getTimelineDetail(userId, orgId, timelineId)
Service->>Service: 조직/멤버/타임라인 검증
Service->>Service: buildMetricList() (활성 지표 구성)
Service->>Repo: findByOrgAndPeriodAndGrain(orgId, startDate, endDate, Grain.DAILY)
Repo-->>Service: List<MetricFact>
Service->>Service: buildDailyTrend(metricFacts) -> 일별 합계, ROAS 계산
Service->>Service: buildPlatformContributions(metricFacts) -> provider별 기여율 계산
Service->>Conv: toTimelineDetailDTO(timeline, metrics, dailyTrend, platformContributions)
Conv-->>Service: TimelineDetailDTO
Service-->>Controller: TimelineDetailDTO
Controller-->>User: DataResponse<TimelineDetailDTO> (200)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@src/main/java/com/whereyouad/WhereYouAd/domains/timeline/domain/service/TimelineServiceImpl.java`:
- Around line 240-279: buildDailyTrend currently only emits dates present in the
facts map, which omits empty dates between the timeline range; modify
buildDailyTrend to iterate from timeline.getStartDate() to
timeline.getEndDate(), use the existing byDate Map<LocalDate,List<MetricFact>>
to lookup dayFacts (empty list when missing), and produce a
TimelineResponse.DailyMetricDTO for every date in that range; when a date has no
facts treat numeric sums as 0 (or null if the metric is disabled via
timeline.isUseClick()/isUseConversion()/isUseImpression()), and compute ROAS the
same way as now but return null if totalSpend is zero. Ensure the method still
sorts by date and returns a continuous list for the full period.
- Around line 136-147: After updating the Timeline entity in TimelineServiceImpl
(after timeline.update(...) and before returning the response), clear or refresh
the AI summary so stale text isn't returned; either call a domain method like
timeline.clearAiSummary() or timeline.setAiSummary(null) to reset it, or invoke
the AI summary generator (e.g.,
aiSummaryService.generateAndSaveSummary(timeline) or similar) to immediately
regenerate and persist a new summary, then proceed to calculate
PerformanceStatus and return TimelineConverter.toCreateResponse(timeline).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: f37e7a1f-a6c6-4ca5-ab00-bbce43d2189c
📒 Files selected for processing (10)
src/main/java/com/whereyouad/WhereYouAd/domains/advertisement/persistence/repository/MetricFactRepository.javasrc/main/java/com/whereyouad/WhereYouAd/domains/timeline/application/dto/response/TimelineResponse.javasrc/main/java/com/whereyouad/WhereYouAd/domains/timeline/application/mapper/TimelineConverter.javasrc/main/java/com/whereyouad/WhereYouAd/domains/timeline/domain/service/TimelineService.javasrc/main/java/com/whereyouad/WhereYouAd/domains/timeline/domain/service/TimelineServiceImpl.javasrc/main/java/com/whereyouad/WhereYouAd/domains/timeline/exception/code/TimelineErrorCode.javasrc/main/java/com/whereyouad/WhereYouAd/domains/timeline/persistence/entity/Timeline.javasrc/main/java/com/whereyouad/WhereYouAd/domains/timeline/persistence/repository/TimelineRepository.javasrc/main/java/com/whereyouad/WhereYouAd/domains/timeline/presentation/TimelineController.javasrc/main/java/com/whereyouad/WhereYouAd/domains/timeline/presentation/docs/TimelineControllerDocs.java
|
P3: 넵 쿼리문 통합 되면 이어서 리뷰하도록 하겠습니다! 저는 타임라인 삭제랑 수정도 ADMIN이나 MEMBER 모두 가능하게 하는 게 좋을 것 같습니다! |
ojy0903
left a comment
There was a problem hiding this comment.
P4: 고생하셨습니다! 타임라인 상세 조회에서 날짜별로 지표 값 나타내는 로직이 복잡했을 거 같은데 잘 구현해주신거 같아요!! 저도 MetricFact 쿼리문 수정되면 한번 더 확인해보겠습니다. 그리고 제 생각에도 타임라인 수정, 삭제가 ADMIN, MEMBER 모두 가능하게 해도 좋을 것 같습니다!
# Conflicts: # src/main/java/com/whereyouad/WhereYouAd/domains/advertisement/persistence/repository/MetricFactRepository.java
|
provider와 grain을 둘 다 nullable로 만들면 JPQL에서 (:provider IS NULL OR m.provider = :provider) 같은 조건이 생기는데 이게 인덱스를 못탄다고 합니다..! 그래서 두 메서드 다 냅두는 것이 괜찮을 것 같아서 둘 다 뒀습니다! |
|
@CodeRabbit review |
✅ Actions performedReview triggered.
|
ojy0903
left a comment
There was a problem hiding this comment.
P4: MetricFact 관련 repository 메서드 두개 모두 남긴 것 확인했습니다! JPQL 관련 이슈는 잘 몰랐었네요... 둘다 있어도 문제가 있는건 아닌 것 같아 괜찮아 보입니다!
jinnieusLab
left a comment
There was a problem hiding this comment.
P4: 넵 수고하셨습니다! 머지해주시면 판별 로직 쪽도 금방 구현해보겠습니다..!
📌 관련 이슈
🚀 개요
📄 작업 내용
타임라인 상세 조회 시에 AI요약을 저장할 필드가 없어서 추가했습니다
타임라인 조회
dailyTrend에 일별 데이터를 platformContributions에 플랫폼별 기여정보를 반환
📸 스크린샷 / 테스트 결과 (선택)
✅ 체크리스트
🔍 리뷰 포인트 (Review Points)
Summary by CodeRabbit
New Features
Refactor