kt-event-marketing/analytics-service/frontend-backend-validation.md
Hyowon Yang 4421f4447f Analytics Service 프론트엔드 연동을 위한 DTO 필드명 수정 및 증감 데이터 추가
- DTO 필드명 통일 (프론트엔드 호환)
  - totalParticipants → participants
  - channelName → channel
  - totalInvestment → totalCost

- 증감 데이터 필드 추가
  - participantsDelta: 참여자 증감 (현재 0, TODO)
  - targetRoi: 목표 ROI (EventStats에서 가져옴)

- EventStats 엔티티 스키마 변경
  - targetRoi 컬럼 추가 (BigDecimal, default: 0)

- Service 로직 수정
  - AnalyticsService: 필드명 변경 및 증감 데이터 적용
  - ROICalculator: totalCost 필드명 변경
  - UserAnalyticsService: 필드명 변경 및 증감 데이터 적용

- 검증 문서 추가
  - frontend-backend-validation.md: 수정 내용 및 다음 단계 정리

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-28 15:59:49 +09:00

109 lines
2.7 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 백엔드-프론트엔드 API 연동 검증 및 수정 결과
**작업일시**: 2025-10-28
**브랜치**: feature/analytics
**작업 범위**: Analytics Service 백엔드 DTO 및 Service 수정
---
## 📝 수정 요약
### 1⃣ 필드명 통일 (프론트엔드 호환)
**목적**: 프론트엔드 Mock 데이터 필드명과 백엔드 Response DTO 필드명 일치
| 수정 전 (백엔드) | 수정 후 (백엔드) | 프론트엔드 |
|-----------------|----------------|-----------|
| `summary.totalParticipants` | `summary.participants` | `summary.participants` ✅ |
| `channelPerformance[].channelName` | `channelPerformance[].channel` | `channelPerformance[].channel` ✅ |
| `roi.totalInvestment` | `roi.totalCost` | `roiDetail.totalCost` ✅ |
### 2⃣ 증감 데이터 추가
**목적**: 프론트엔드에서 요구하는 증감 표시 및 목표값 제공
| 필드 | 타입 | 설명 | 현재 값 |
|-----|------|------|---------|
| `summary.participantsDelta` | `Integer` | 참여자 증감 (이전 기간 대비) | `0` (TODO: 계산 로직 필요) |
| `summary.targetRoi` | `Double` | 목표 ROI (%) | EventStats에서 가져옴 |
---
## 🔧 수정 파일 목록
### DTO (Response 구조 변경)
1. **AnalyticsSummary.java**
-`totalParticipants``participants`
-`participantsDelta` 필드 추가
-`targetRoi` 필드 추가
2. **ChannelSummary.java**
-`channelName``channel`
3. **RoiSummary.java**
-`totalInvestment``totalCost`
### Entity (데이터베이스 스키마 변경)
4. **EventStats.java**
-`targetRoi` 필드 추가 (`BigDecimal`, default: 0)
### Service (비즈니스 로직 수정)
5. **AnalyticsService.java**
-`.participants()` 사용
-`.participantsDelta(0)` 추가 (TODO 마킹)
-`.targetRoi()` 추가
-`.channel()` 사용
6. **ROICalculator.java**
-`.totalCost()` 사용
7. **UserAnalyticsService.java**
-`.participants()` 사용
-`.participantsDelta(0)` 추가
-`.channel()` 사용
-`.totalCost()` 사용
---
## ✅ 검증 결과
### 컴파일 성공
\`\`\`bash
$ ./gradlew analytics-service:compileJava
BUILD SUCCESSFUL in 8s
\`\`\`
---
## 📊 데이터베이스 스키마 변경
### EventStats 테이블
\`\`\`sql
ALTER TABLE event_stats
ADD COLUMN target_roi DECIMAL(10,2) DEFAULT 0.00;
\`\`\`
**⚠️ 주의사항**
- Spring Boot JPA `ddl-auto` 설정에 따라 자동 적용됨
---
## 📌 다음 단계
### 우선순위 HIGH
1. **프론트엔드 API 연동 테스트**
2. **participantsDelta 계산 로직 구현**
3. **targetRoi 데이터 입력** (Event Service 연동)
### 우선순위 MEDIUM
4. 시간대별 분석 구현
5. 참여자 프로필 구현
6. ROI 세분화 구현