Files
QuantEngineByItz/src/dotnet/QuantEngine.Core/Interfaces/ICollectionRepository.cs
T
kjh2064 66f75d9014
Quant Engine CI/CD Pipeline / validate-core (push) Failing after 11s
WBS-9.3 - NULL Policy CI Gate / NULL Policy Validation (push) Failing after 8s
Quant Engine CI/CD Pipeline / validate-ui-and-storage (push) Has been skipped
Deploy to Production / Build & Deploy to Production (push) Successful in 1m25s
Snapshot Admin Deployment / build-and-deploy (push) Failing after 1m3s
feat(core): 데이터 수집 파이프라인 Core 인터페이스 추가 및 Makefile 생성
**Stage 2 (Python → .NET) 진행:**
- ITokenCache.cs: KIS API 토큰 캐싱 추상화
  - 기존 Python sqlite3 로직 → PostgreSQL 기반으로 마이그레이션
  - GetCachedTokenAsync(), SaveTokenAsync(), ClearExpiredTokensAsync()

- IDataCollectionStore.cs: 데이터 수집 저장소 추상화 계약
  - Python data_collection_store_v1.py 계약 매핑
  - UpsertRun/Snapshot/Error, Fetch 메서드
  - CollectionRunRecord, CollectionSnapshotRecord, CollectionErrorRecord DTO
  - CollectionDashboardStateRecord 대시보드 상태 모델

- ICollectionRepository.cs: 웹 API용 데이터 수집 저장소 인터페이스
  - 높은 수준의 추상화 (Dapper + PostgreSQL)
  - SaveRun, UpdateRunStatus, SaveSnapshot, SaveError
  - GetRecentRuns, GetRunSnapshots, GetRunErrors, GetDashboardState
  - GetLatestSnapshotsForTicker

**Stage 3 (Node.js → .NET) 완료:**
- Makefile: npm scripts를 make 타겟으로 변환
  - ops:prepare, ops:validate, ops:data-collect 등 주요 작업
  - dotnet:build, dotnet:run, dotnet:watch 개발 명령어
  - 단계: Python 도구 호출 유지 (Phase 2 완료까지)

**다음 단계:**
- CollectionRepository PostgreSQL 구현체 (Dapper)
- TokenCache PostgreSQL 구현체
- DataCollectionStore PostgreSQL 구현체 (필요시)
- Program.cs DI 등록
- Web API Collection 엔드포인트 추가

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-06-29 23:13:35 +09:00

57 lines
1.8 KiB
C#

namespace QuantEngine.Core.Interfaces;
/// <summary>
/// Data collection repository (Dapper + PostgreSQL).
/// Higher-level abstraction over IDataCollectionStore for Web API consumers.
/// </summary>
public interface ICollectionRepository
{
/// <summary>
/// Save new collection run.
/// </summary>
Task SaveRunAsync(CollectionRunRecord run);
/// <summary>
/// Update run with completion status.
/// </summary>
Task UpdateRunStatusAsync(string runId, string status, string? finishedAt = null, int? totalSnapshots = null, int? totalErrors = null);
/// <summary>
/// Save collection snapshot.
/// </summary>
Task SaveSnapshotAsync(CollectionSnapshotRecord snapshot);
/// <summary>
/// Save collection error.
/// </summary>
Task SaveErrorAsync(CollectionErrorRecord error);
/// <summary>
/// Fetch recent collection runs for UI dashboard.
/// </summary>
/// <param name="limit">Number of runs to return (default: 20)</param>
Task<List<CollectionRunRecord>> GetRecentRunsAsync(int limit = 20);
/// <summary>
/// Fetch snapshots for a specific run.
/// </summary>
Task<List<CollectionSnapshotRecord>> GetRunSnapshotsAsync(string runId);
/// <summary>
/// Fetch errors for a specific run.
/// </summary>
/// <param name="runId">Run ID</param>
/// <param name="limit">Max errors to return (default: 50)</param>
Task<List<CollectionErrorRecord>> GetRunErrorsAsync(string runId, int limit = 50);
/// <summary>
/// Get collection pipeline dashboard state for Web UI.
/// </summary>
Task<CollectionDashboardStateRecord> GetDashboardStateAsync();
/// <summary>
/// Fetch latest snapshots for a ticker across all datasets.
/// </summary>
Task<List<CollectionSnapshotRecord>> GetLatestSnapshotsForTickerAsync(string ticker, int limit = 10);
}