This commit is contained in:
Waylon S. Walker 2024-12-11 09:17:38 -06:00
parent a70c24398a
commit e181f57a91
30 changed files with 2458 additions and 197 deletions

View file

@ -1,24 +1,42 @@
import asyncio
import time
from typing import Annotated
from fastapi import APIRouter
from fastapi import APIRouter, Depends, Header
from fastapi.requests import Request
from sqlmodel import Session
boosted_router = APIRouter(prefix="/boosted", tags=["Shots Methods"])
from htmx_patterns.boosted.models import PersonFactory
from htmx_patterns.config import get_config
from htmx_patterns.config import get_config, get_session
from htmx_patterns.models import Person
boosted_router = APIRouter(prefix="/boosted", tags=["Boosted"])
config = get_config()
@boosted_router.get("/")
@boosted_router.get("")
async def boosted(request: Request, id: int = 0):
# simulate getting a person by id
person = PersonFactory.build()
async def boosted(
request: Request,
id: int = 1,
session: Session = Depends(get_session),
user_agent: Annotated[str | None, Header()] = None,
):
# person = PersonFactory.build()
person = Person.get_by_id(session, id)
if id > 0:
if person is None:
return config.templates.TemplateResponse(
"boosted/person.html",
{
"request": request,
"person": None,
"person_id": id,
"prev_id": None,
"next_id": 1,
},
)
if id > 1:
prev_id = id - 1
next_id = id + 1
else: