- Fix `simple_test_analysis` template in E2E test setup to align with Orchestrator's data fetch logic.
- Implement and verify additional E2E scenarios:
- Scenario C: Partial Provider Failure (verified error propagation fix in Orchestrator).
- Scenario D: Invalid Symbol input.
- Scenario E: Analysis Module failure.
- Update `WorkflowStateMachine::handle_report_failed` to correctly scope error broadcasting to the specific task instead of failing effectively silently or broadly.
- Update testing strategy documentation to reflect completed Phase 4 testing.
- Skip Scenario B (Orchestrator Restart) as persistence is not yet implemented (decision made to defer persistence).
129 lines
2.9 KiB
Rust
129 lines
2.9 KiB
Rust
use chrono::NaiveDate;
|
|
use service_kit::api_dto;
|
|
use serde_json::Value as JsonValue;
|
|
use uuid::Uuid;
|
|
|
|
// Companies API DTOs
|
|
#[api_dto]
|
|
pub struct CompanyProfileDto {
|
|
pub symbol: String,
|
|
pub name: String,
|
|
pub industry: Option<String>,
|
|
pub list_date: Option<NaiveDate>,
|
|
pub additional_info: Option<JsonValue>,
|
|
pub updated_at: Option<chrono::DateTime<chrono::Utc>>,
|
|
}
|
|
|
|
// Market Data API DTOs
|
|
#[api_dto]
|
|
pub struct TimeSeriesFinancialDto {
|
|
pub symbol: String,
|
|
pub metric_name: String,
|
|
pub period_date: NaiveDate,
|
|
pub value: f64,
|
|
pub source: Option<String>,
|
|
}
|
|
|
|
#[api_dto]
|
|
pub struct DailyMarketDataDto {
|
|
pub symbol: String,
|
|
pub trade_date: NaiveDate,
|
|
pub open_price: Option<f64>,
|
|
pub high_price: Option<f64>,
|
|
pub low_price: Option<f64>,
|
|
pub close_price: Option<f64>,
|
|
pub volume: Option<i64>,
|
|
pub pe: Option<f64>,
|
|
pub pb: Option<f64>,
|
|
pub total_mv: Option<f64>,
|
|
}
|
|
|
|
// Batch DTOs
|
|
#[api_dto]
|
|
pub struct TimeSeriesFinancialBatchDto {
|
|
pub records: Vec<TimeSeriesFinancialDto>,
|
|
}
|
|
|
|
#[api_dto]
|
|
pub struct DailyMarketDataBatchDto {
|
|
pub records: Vec<DailyMarketDataDto>,
|
|
}
|
|
|
|
// Analysis Results API DTOs (NEW)
|
|
#[api_dto]
|
|
pub struct NewAnalysisResult {
|
|
pub request_id: Uuid,
|
|
pub symbol: String,
|
|
pub template_id: String,
|
|
pub module_id: String,
|
|
pub content: String,
|
|
pub meta_data: JsonValue,
|
|
}
|
|
|
|
/// Represents a persisted analysis result read from the database.
|
|
#[api_dto]
|
|
pub struct AnalysisResultDto {
|
|
pub id: Uuid,
|
|
pub request_id: Uuid,
|
|
pub symbol: String,
|
|
pub template_id: String,
|
|
pub module_id: String,
|
|
pub content: String,
|
|
pub meta_data: JsonValue,
|
|
pub created_at: chrono::DateTime<chrono::Utc>,
|
|
}
|
|
|
|
|
|
// Realtime Quotes DTOs
|
|
#[api_dto]
|
|
pub struct RealtimeQuoteDto {
|
|
pub symbol: String,
|
|
pub market: String,
|
|
pub ts: chrono::DateTime<chrono::Utc>,
|
|
pub price: f64,
|
|
pub open_price: Option<f64>,
|
|
pub high_price: Option<f64>,
|
|
pub low_price: Option<f64>,
|
|
pub prev_close: Option<f64>,
|
|
pub change: Option<f64>,
|
|
pub change_percent: Option<f64>,
|
|
pub volume: Option<i64>,
|
|
pub source: Option<String>,
|
|
}
|
|
|
|
use crate::observability::TaskStatus;
|
|
|
|
#[api_dto]
|
|
pub struct ProviderStatusDto {
|
|
pub last_updated: chrono::DateTime<chrono::Utc>,
|
|
pub status: TaskStatus,
|
|
pub data_version: Option<String>,
|
|
}
|
|
|
|
// Provider Path Params
|
|
#[api_dto]
|
|
#[derive(utoipa::IntoParams)]
|
|
pub struct ProviderPathParams {
|
|
pub symbol: String,
|
|
pub provider_id: String,
|
|
}
|
|
|
|
// Session Data & Cache DTOs
|
|
#[api_dto]
|
|
pub struct SessionDataDto {
|
|
pub request_id: Uuid,
|
|
pub symbol: String,
|
|
pub provider: String,
|
|
pub data_type: String,
|
|
pub data_payload: JsonValue,
|
|
pub created_at: Option<chrono::DateTime<chrono::Utc>>,
|
|
}
|
|
|
|
#[api_dto]
|
|
pub struct ProviderCacheDto {
|
|
pub cache_key: String,
|
|
pub data_payload: JsonValue,
|
|
pub expires_at: chrono::DateTime<chrono::Utc>,
|
|
pub updated_at: Option<chrono::DateTime<chrono::Utc>>,
|
|
}
|