first commit

This commit is contained in:
2026-01-17 15:21:41 -05:00
commit b93d41c1ae
36 changed files with 3391 additions and 0 deletions

23
routes/info/pricing.py Normal file
View File

@@ -0,0 +1,23 @@
from fastapi import APIRouter, Depends
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy import select
from database import get_db
from models import Pricing_Oil_Oil
router = APIRouter()
@router.get("/current")
async def get_current_pricing(db: AsyncSession = Depends(get_db)):
# Get the latest pricing record
pricing = await db.execute(
select(Pricing_Oil_Oil).order_by(Pricing_Oil_Oil.id.desc()).limit(1)
)
pricing = pricing.scalar_one_or_none()
if not pricing:
return {"price_per_gallon": 0.00, "message": "No pricing available"}
return {
"price_per_gallon": float(pricing.price_for_customer),
"date": pricing.date.isoformat() if pricing.date else None
}