refacto: rename app into backend, to prepare for frontend dev

This commit is contained in:
Alexis Fourmaux 2026-05-11 21:09:49 +02:00
parent 017092040d
commit e605bf8603
32 changed files with 2 additions and 2 deletions

View file

@ -0,0 +1,28 @@
from datetime import datetime
from pydantic import BaseModel
from domain.entities import ConsumptionResponse
class ConsumptionPointSchema(BaseModel):
period: datetime
pulse_count_start: int
pulse_count_end: int
delta_pulses: int
delta_m3: float
class ConsumptionResponseSchema(BaseModel):
dev_eui: str
start: datetime
end: datetime
granularity: str
points: list[ConsumptionPointSchema]
@classmethod
def from_domain(cls, r: ConsumptionResponse) -> "ConsumptionResponseSchema":
return cls(
dev_eui=r.dev_eui,
start=r.start,
end=r.end,
granularity=r.granularity,
points=[ConsumptionPointSchema(**p.__dict__) for p in r.points],
)