Improve frontend 5
This commit is contained in:
@@ -42,6 +42,12 @@ router = APIRouter(prefix="/api/v1/tenants/{tenant_id}/dashboard", tags=["dashbo
|
||||
# Response Models
|
||||
# ============================================================
|
||||
|
||||
class I18nData(BaseModel):
|
||||
"""i18n translation data"""
|
||||
key: str = Field(..., description="i18n translation key")
|
||||
params: Optional[Dict[str, Any]] = Field(default_factory=dict, description="Parameters for translation")
|
||||
|
||||
|
||||
class HeadlineData(BaseModel):
|
||||
"""i18n-ready headline data"""
|
||||
key: str = Field(..., description="i18n translation key")
|
||||
@@ -103,12 +109,12 @@ class OrchestrationSummaryResponse(BaseModel):
|
||||
userActionsRequired: int = Field(..., description="Number of actions needing approval")
|
||||
durationSeconds: Optional[int] = Field(None, description="How long orchestration took")
|
||||
aiAssisted: bool = Field(False, description="Whether AI insights were used")
|
||||
message: Optional[str] = Field(None, description="User-friendly message")
|
||||
message_i18n: Optional[I18nData] = Field(None, description="i18n data for message")
|
||||
|
||||
|
||||
class ActionButton(BaseModel):
|
||||
"""Action button configuration"""
|
||||
label: str
|
||||
label_i18n: I18nData = Field(..., description="i18n data for button label")
|
||||
type: str = Field(..., description="Button type: primary, secondary, tertiary")
|
||||
action: str = Field(..., description="Action identifier")
|
||||
|
||||
@@ -118,10 +124,14 @@ class ActionItem(BaseModel):
|
||||
id: str
|
||||
type: str = Field(..., description="Action type")
|
||||
urgency: str = Field(..., description="Urgency: critical, important, normal")
|
||||
title: str
|
||||
subtitle: str
|
||||
reasoning: str = Field(..., description="Why this action is needed")
|
||||
consequence: str = Field(..., description="What happens if not done")
|
||||
title: Optional[str] = Field(None, description="Legacy field for alerts")
|
||||
title_i18n: Optional[I18nData] = Field(None, description="i18n data for title")
|
||||
subtitle: Optional[str] = Field(None, description="Legacy field for alerts")
|
||||
subtitle_i18n: Optional[I18nData] = Field(None, description="i18n data for subtitle")
|
||||
reasoning: Optional[str] = Field(None, description="Legacy field for alerts")
|
||||
reasoning_i18n: Optional[I18nData] = Field(None, description="i18n data for reasoning")
|
||||
consequence_i18n: I18nData = Field(..., description="i18n data for consequence")
|
||||
reasoning_data: Optional[Dict[str, Any]] = Field(None, description="Structured reasoning data")
|
||||
amount: Optional[float] = Field(None, description="Amount for financial actions")
|
||||
currency: Optional[str] = Field(None, description="Currency code")
|
||||
actions: List[ActionButton]
|
||||
@@ -152,7 +162,9 @@ class ProductionTimelineItem(BaseModel):
|
||||
progress: int = Field(..., ge=0, le=100, description="Progress percentage")
|
||||
readyBy: Optional[str]
|
||||
priority: str
|
||||
reasoning: str
|
||||
reasoning_data: Optional[Dict[str, Any]] = Field(None, description="Structured reasoning data")
|
||||
reasoning_i18n: Optional[I18nData] = Field(None, description="i18n data for reasoning")
|
||||
status_i18n: Optional[I18nData] = Field(None, description="i18n data for status")
|
||||
|
||||
|
||||
class ProductionTimelineResponse(BaseModel):
|
||||
@@ -164,12 +176,17 @@ class ProductionTimelineResponse(BaseModel):
|
||||
pendingBatches: int
|
||||
|
||||
|
||||
class InsightCardI18n(BaseModel):
|
||||
"""i18n data for insight card"""
|
||||
label: I18nData = Field(..., description="i18n data for label")
|
||||
value: I18nData = Field(..., description="i18n data for value")
|
||||
detail: Optional[I18nData] = Field(None, description="i18n data for detail")
|
||||
|
||||
|
||||
class InsightCard(BaseModel):
|
||||
"""Individual insight card"""
|
||||
label: str
|
||||
value: str
|
||||
detail: str
|
||||
color: str = Field(..., description="Color: green, amber, red")
|
||||
i18n: InsightCardI18n = Field(..., description="i18n translation data")
|
||||
|
||||
|
||||
class InsightsResponse(BaseModel):
|
||||
|
||||
Reference in New Issue
Block a user