Files
sam-docs/changes/20260122_card_transaction_dashboard_api.md
권혁성 0c1a1a5785 docs: Phase 1.1 카드 거래 대시보드 API 개발 완료
- 카드/가지급금 관리 섹션 계획 문서 추가
- 변경 이력 문서 추가

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-22 22:28:41 +09:00

2.5 KiB

변경 내용 요약

날짜: 2026-01-22 작업자: Claude Code 계획 문서: docs/plans/card-management-section-plan.md Phase: 1.1 카드 거래 대시보드 API 개발

📋 변경 개요

CEO 대시보드 카드/가지급금 관리 섹션(cm1)의 모달 팝업용 카드 거래 대시보드 API 엔드포인트 신규 추가. 기존 summary API를 확장하여 월별 추이, 사용자별 비율, 최근 거래 목록을 포함한 상세 데이터 제공.

📁 수정된 파일

  • api/app/Services/CardTransactionService.php - dashboard() 메서드 및 헬퍼 메서드 추가
  • api/app/Http/Controllers/Api/V1/CardTransactionController.php - dashboard() 액션 추가
  • api/routes/api.php - /dashboard 라우트 등록
  • api/app/Swagger/v1/CardTransactionApi.php - 대시보드 스키마 및 엔드포인트 문서화

🔧 상세 변경 사항

1. CardTransactionService.php

신규 메서드:

  • dashboard() - 대시보드 전체 데이터 반환
  • getMonthTotal() - 특정 기간 카드 사용액 합계 (private)
  • getMonthlyTrend() - 최근 N개월 월별 추이 (private)
  • getUserRatio() - 사용자별 카드 사용 비율 (private)
  • getRecentTransactions() - 최근 거래 목록 (private)

응답 구조:

[
    'summary' => [
        'current_month_total' => float,
        'previous_month_total' => float,
        'change_rate' => float,
        'unprocessed_count' => int,
    ],
    'monthly_trend' => [...],
    'user_ratio' => [...],
    'recent_transactions' => [...],
]

2. CardTransactionController.php

신규 액션:

public function dashboard(): JsonResponse

3. api/routes/api.php

신규 라우트:

Route::get('/dashboard', [CardTransactionController::class, 'dashboard'])
    ->name('v1.card-transactions.dashboard');

4. CardTransactionApi.php (Swagger)

신규 스키마:

  • CardTransactionDashboard - 대시보드 응답 전체 구조

신규 엔드포인트:

  • GET /api/v1/card-transactions/dashboard

테스트 체크리스트

  • Pint 코드 스타일 검증 통과
  • 라우트 등록 확인 (php artisan route:list)
  • Swagger 문서 생성 완료
  • API 호출 테스트 (Swagger UI)
  • 프론트엔드 연동 테스트

⚠️ 배포 시 주의사항

특이사항 없음 (DB 스키마 변경 없음)

🔗 관련 문서

  • 계획 문서: docs/plans/card-management-section-plan.md
  • 기존 API 문서: api/app/Swagger/v1/CardTransactionApi.php