- 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.
25 lines
703 B
Python
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
|
|
})
|