Add version number and fix warnings

This commit is contained in:
2025-05-28 12:37:03 +02:00
parent 521a0d6937
commit 2afa7dbebf
11 changed files with 332 additions and 117 deletions

View File

@@ -5,14 +5,15 @@ from sqlalchemy import text
from typing import List
import models, schemas
from database import engine, get_db
from version import __version__, __app_name__, __description__
# Create database tables
models.Base.metadata.create_all(bind=engine)
app = FastAPI(
title="Product Tracker API",
description="API for tracking product prices and shopping events",
version="1.0.0"
title=__app_name__,
description=__description__,
version=__version__
)
# CORS middleware for React frontend
@@ -92,7 +93,7 @@ def build_shopping_event_response(event: models.ShoppingEvent, db: Session) -> s
# Root endpoint
@app.get("/")
def read_root():
return {"message": "Product Tracker API", "version": "1.0.0"}
return {"message": __app_name__, "version": __version__, "name": "Groceries Tracker Backend"}
# Product endpoints
@app.post("/products/", response_model=schemas.Product)