Files

42 lines
944 B
Python
Raw Permalink Normal View History

2026-04-27 16:40:50 +03:30
from __future__ import annotations
from uuid import UUID
from pydantic import Field
from .common import ApiEnvelope, RouteContract, SchemaModel
HTTP_METHOD = 'POST'
ROUTE_PATH = '/api/weather/farm-card/'
class WeatherFarmCardRequest(SchemaModel):
farm_uuid: UUID
class WeatherChartData(SchemaModel):
labels: list[str] = Field(default_factory=list)
series: list[list[float]] = Field(default_factory=list)
class WeatherFarmCardResponseData(SchemaModel):
condition: str
temperature: float | int
unit: str
humidity: float | int
windSpeed: float | int
windUnit: str
chartData: WeatherChartData = Field(default_factory=WeatherChartData)
class WeatherFarmCardResponse(ApiEnvelope[WeatherFarmCardResponseData]):
pass
CONTRACT = RouteContract(
method=HTTP_METHOD,
path=ROUTE_PATH,
request_model=WeatherFarmCardRequest.__name__,
response_model=WeatherFarmCardResponse.__name__,
)