feat(collection): PostgreSQL 백킹 활성화 (CollectionRepository + TokenCache)
WBS-9.3 - NULL Policy CI Gate / NULL Policy Validation (push) Failing after 7s
Quant Engine CI/CD Pipeline / validate-ui-and-storage (push) Has been skipped
Quant Engine CI/CD Pipeline / validate-core (push) Failing after 13s
Snapshot Admin Deployment / build-and-deploy (push) Failing after 1m21s
Deploy to Production / Build & Deploy to Production (push) Successful in 1m55s
WBS-9.3 - NULL Policy CI Gate / NULL Policy Validation (push) Failing after 7s
Quant Engine CI/CD Pipeline / validate-ui-and-storage (push) Has been skipped
Quant Engine CI/CD Pipeline / validate-core (push) Failing after 13s
Snapshot Admin Deployment / build-and-deploy (push) Failing after 1m21s
Deploy to Production / Build & Deploy to Production (push) Successful in 1m55s
- Program.cs: PlaceholderCollectionRepository/TokenCache/KisApiClient → 실제 구현체로 변경 - 데이터베이스 초기화: EnsureTablesAsync() 호출 (시작 시 테이블 자동 생성) - kis_tokens, kis_collection_runs, kis_collection_snapshots, kis_collection_errors 테이블 - Dapper 기반 SQL 쿼리 (파라미터화, SQL 주입 방지) - 인덱스: started_at, ticker, captured_at, run_id - PlaceholderImplementations.cs 제거 Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -37,10 +37,10 @@ builder.Services.AddScoped<IPostgresqlHistoryStore, PostgresqlHistoryStore>();
|
||||
builder.Services.AddScoped<IPostgresqlHistorySnapshotReader, PostgresqlHistorySnapshotReader>();
|
||||
builder.Services.AddScoped<HistoryIngestionService>();
|
||||
|
||||
// Collection Pipeline Services (using placeholder implementations for now)
|
||||
builder.Services.AddScoped<ICollectionRepository, PlaceholderCollectionRepository>();
|
||||
builder.Services.AddScoped<ITokenCache, PlaceholderTokenCache>();
|
||||
builder.Services.AddScoped<IKisApiClient, PlaceholderKisApiClient>();
|
||||
// Collection Pipeline Services (PostgreSQL-backed implementations)
|
||||
builder.Services.AddScoped<ICollectionRepository, CollectionRepository>();
|
||||
builder.Services.AddScoped<ITokenCache, PostgresTokenCache>();
|
||||
builder.Services.AddScoped<IKisApiClient, KisApiClient>();
|
||||
|
||||
// HTTP Client & API Services
|
||||
builder.Services.AddHttpClient<ApiClient>();
|
||||
@@ -48,6 +48,25 @@ builder.Services.AddScoped<ApiClient>();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Initialize database tables (PostgreSQL-backed repositories)
|
||||
using (var scope = app.Services.CreateScope())
|
||||
{
|
||||
var tokenCache = scope.ServiceProvider.GetRequiredService<ITokenCache>();
|
||||
var collectionRepo = scope.ServiceProvider.GetRequiredService<ICollectionRepository>();
|
||||
|
||||
try
|
||||
{
|
||||
// Ensure tables exist on startup
|
||||
await tokenCache.GetCachedTokenAsync("_init_test_");
|
||||
await collectionRepo.GetDashboardStateAsync();
|
||||
Log.Information("Database tables initialized successfully");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Warning($"Database initialization warning: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
// Enable reverse proxy subpath mapping
|
||||
app.UsePathBase("/quant");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user