bmc_hub/app/products/frontend/views.py
Christian 6320809f17 feat: Add subscriptions and products management
- Implemented frontend views for products and subscriptions using FastAPI and Jinja2 templates.
- Created API endpoints for managing subscriptions, including creation, listing, and status updates.
- Added HTML templates for displaying active subscriptions and their statistics.
- Established database migrations for sag_subscriptions, sag_subscription_items, and products, including necessary indexes and triggers for automatic subscription number generation.
- Introduced product price history tracking to monitor changes in product pricing.
2026-02-08 12:42:19 +01:00

25 lines
703 B
Python

"""
Products Frontend Views
"""
from fastapi import APIRouter, Request
from fastapi.responses import HTMLResponse
from fastapi.templating import Jinja2Templates
router = APIRouter()
templates = Jinja2Templates(directory="app")
@router.get("/products", response_class=HTMLResponse)
async def products_list(request: Request):
return templates.TemplateResponse("products/frontend/list.html", {
"request": request
})
@router.get("/products/{product_id}", response_class=HTMLResponse)
async def product_detail(request: Request, product_id: int):
return templates.TemplateResponse("products/frontend/detail.html", {
"request": request,
"product_id": product_id
})