From 903d2cfb0b1360259b8ca1ff252334a827a611c0 Mon Sep 17 00:00:00 2001 From: haneulai Date: Thu, 22 Jan 2026 15:22:22 +0900 Subject: [PATCH] fix: change plant_id to str, timestamp to created_at for DB schema match --- app/schemas/plant.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/schemas/plant.py b/app/schemas/plant.py index 5aaea15..ffdcbc4 100644 --- a/app/schemas/plant.py +++ b/app/schemas/plant.py @@ -20,9 +20,11 @@ class PlantBase(BaseModel): class SolarLogBase(BaseModel): """발전 로그 기본 정보 스키마""" + model_config = {"from_attributes": True} + id: int - plant_id: int - timestamp: datetime + plant_id: str # DB에서 'nrems-01' 같은 문자열 형식 사용 + created_at: datetime # DB 컬럼명과 일치 power_output: Optional[float] = Field(None, description="현재 발전량 (kW)") daily_generation: Optional[float] = Field(None, description="일일 발전량 (kWh)") total_generation: Optional[float] = Field(None, description="누적 발전량 (kWh)")