From f392c3edaf52ccfa496d2e85f96e18ec81d11a65 Mon Sep 17 00:00:00 2001 From: Luiz Gustavo Monteiro Date: Mon, 3 Nov 2025 23:39:34 -0300 Subject: refactor Post methods in schema files --- api/schemas/station.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'api/schemas') diff --git a/api/schemas/station.py b/api/schemas/station.py index e69de29..3e8dc10 100644 --- a/api/schemas/station.py +++ b/api/schemas/station.py @@ -0,0 +1,6 @@ +from pydantic import BaseModel + +class PostStation(BaseModel): + name: str + installation_date: int + location_id: int \ No newline at end of file -- cgit v1.2.3 From cc1b5e2f48ef62670be05ccfc6346b16b61844c8 Mon Sep 17 00:00:00 2001 From: Luiz Gustavo Monteiro Date: Mon, 3 Nov 2025 23:40:37 -0300 Subject: refactor Post methods in schema files --- api/routes/measures.py | 6 +----- api/schemas/location.py | 6 ++++++ api/schemas/measures.py | 5 +++++ api/schemas/sensor.py | 6 ++++++ 4 files changed, 18 insertions(+), 5 deletions(-) (limited to 'api/schemas') diff --git a/api/routes/measures.py b/api/routes/measures.py index b435ae3..7aea38e 100644 --- a/api/routes/measures.py +++ b/api/routes/measures.py @@ -2,7 +2,7 @@ from fastapi import APIRouter from sqlalchemy import select from ..database import SessionLocal from ..models import Measure -from pydantic import BaseModel +from ..schemas.measures import PostMeasure router = APIRouter( prefix='/measures', @@ -26,10 +26,6 @@ async def get_measures(): session.close() return dc -class PostMeasure(BaseModel): - name: str - unit_code: str - @router.post('/') async def post_measure(measure: PostMeasure): session = SessionLocal() diff --git a/api/schemas/location.py b/api/schemas/location.py index e69de29..102e3d9 100644 --- a/api/schemas/location.py +++ b/api/schemas/location.py @@ -0,0 +1,6 @@ +from pydantic import BaseModel + +class PostLocation(BaseModel): + street: str + avenue: str + zip_code:str \ No newline at end of file diff --git a/api/schemas/measures.py b/api/schemas/measures.py index e69de29..999a82c 100644 --- a/api/schemas/measures.py +++ b/api/schemas/measures.py @@ -0,0 +1,5 @@ +from pydantic import BaseModel + +class PostMeasure(BaseModel): + name: str + unit_code: str \ No newline at end of file diff --git a/api/schemas/sensor.py b/api/schemas/sensor.py index e69de29..e038378 100644 --- a/api/schemas/sensor.py +++ b/api/schemas/sensor.py @@ -0,0 +1,6 @@ +from pydantic import BaseModel + +class PostSensor(BaseModel): + name: str + installation_date: int | None = None + station_id: int \ No newline at end of file -- cgit v1.2.3