37 lines
620 B
Python
37 lines
620 B
Python
from pydantic import BaseModel, Field
|
|
from typing import List, Optional, Dict, Any
|
|
from datetime import datetime
|
|
|
|
|
|
class RateBase(BaseModel):
|
|
id: str
|
|
symbol: str
|
|
currency_symbol: Optional[str] = None
|
|
type: str
|
|
rate_usd: str
|
|
|
|
|
|
class RateCreate(RateBase):
|
|
pass
|
|
|
|
|
|
class RateInDB(RateBase):
|
|
last_updated: datetime
|
|
|
|
class Config:
|
|
orm_mode = True
|
|
|
|
|
|
class RatesResponse(BaseModel):
|
|
data: List[RateBase]
|
|
timestamp: int
|
|
|
|
|
|
class SingleRateResponse(BaseModel):
|
|
data: RateBase
|
|
timestamp: int
|
|
|
|
|
|
class ErrorResponse(BaseModel):
|
|
error: str
|
|
timestamp: Optional[int] = None |