Coverage for health / models / sync_metadata.py: 0%
17 statements
« prev ^ index » next coverage.py v7.13.4, created at 2026-03-02 17:44 +0800
« prev ^ index » next coverage.py v7.13.4, created at 2026-03-02 17:44 +0800
1"""
2Pydantic models for sync metadata and tracking.
3"""
5from datetime import date, datetime
6from typing import Optional
7from pydantic import BaseModel, Field
10class SyncRecord(BaseModel):
11 """Record of a sync operation."""
13 id: Optional[int] = None
14 data_type: str = Field(..., description="Type of data synced")
15 start_date: date = Field(..., description="Start date of sync range")
16 end_date: date = Field(..., description="End date of sync range")
17 status: str = Field(..., description="Sync status: success, failed, partial")
18 records_synced: int = Field(default=0, description="Number of records synced")
19 error_message: Optional[str] = Field(
20 default=None, description="Error message if sync failed"
21 )
22 created_at: Optional[datetime] = None
25class LastSyncState(BaseModel):
26 """Last sync state for a data type."""
28 data_type: str = Field(..., description="Type of data")
29 last_sync_date: date = Field(..., description="Last successfully synced date")
30 total_records: int = Field(default=0, description="Total records synced")
31 updated_at: Optional[datetime] = None