Some checks are pending
CI / Crawler (Python ${{ matrix.python-version }}) (3.10) (push) Waiting to run
CI / Crawler (Python ${{ matrix.python-version }}) (3.11) (push) Waiting to run
CI / API (Python 3.11) (push) Waiting to run
CI / Database migration (push) Waiting to run
CI / App web build (Node 20) (push) Waiting to run
51 lines
950 B
Python
51 lines
950 B
Python
"""통계 API 응답 스키마."""
|
|
|
|
from typing import List, Literal
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class ComparisonStatItem(BaseModel):
|
|
plant_id: str
|
|
plant_name: str
|
|
capacity: float
|
|
generation: float
|
|
generation_hours: float
|
|
|
|
|
|
class ComparisonStatsResponse(BaseModel):
|
|
status: Literal["success"]
|
|
period: Literal["day", "month", "year"]
|
|
target_date: str
|
|
data: List[ComparisonStatItem]
|
|
count: int
|
|
|
|
|
|
class StatPoint(BaseModel):
|
|
label: str
|
|
value: float
|
|
|
|
|
|
class PlantStatsResponse(BaseModel):
|
|
status: Literal["success"]
|
|
plant_id: str
|
|
period: Literal["day", "month", "year"]
|
|
data: List[StatPoint]
|
|
count: int
|
|
|
|
|
|
class HourlyStatPoint(BaseModel):
|
|
hour: int
|
|
label: str
|
|
current_kw: float
|
|
today_kwh: float
|
|
has_data: bool
|
|
|
|
|
|
class HourlyStatsResponse(BaseModel):
|
|
status: Literal["success"]
|
|
plant_id: str
|
|
date: str
|
|
data: List[HourlyStatPoint]
|
|
count: int
|