22 lines
636 B
Python
22 lines
636 B
Python
from fastapi import APIRouter, Depends
|
|
from fastapi.params import Security
|
|
from sqlalchemy.orm import Session
|
|
|
|
from app.security import get_api_key
|
|
from app.database import get_db
|
|
from app.schemas.meter_value import MeterValue
|
|
from app.models.meter_value import MeterValue as DbMeterValue
|
|
|
|
router = APIRouter(
|
|
prefix="/meter-values",
|
|
tags=["MeterValue (v1)"]
|
|
)
|
|
|
|
@router.get(path="", response_model=list[MeterValue])
|
|
async def get_meter_values(
|
|
skip: int = 0,
|
|
limit: int = 20,
|
|
api_key: str = Security(get_api_key),
|
|
db: Session = Depends(get_db)
|
|
):
|
|
return db.query(DbMeterValue).offset(skip).limit(limit).all() |