feat: REST API + operator admin route
views_api.py exposes the booking flow over HTTP — availability check, guest booking request (check-then-hold with canonical amount_sat), room publish, blocks. REST and Nostr are two doors into the same crud flow; FX + invoice creation marked TODO. views.py serves the operator page. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019VUQCfdqiLSsFS2jcGnaFD
This commit is contained in:
parent
900b682986
commit
d5df9ab662
2 changed files with 206 additions and 0 deletions
22
views.py
Normal file
22
views.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
"""Frontend routes — serves the operator admin page. SKETCH: single index
|
||||
template; the guest-facing booking UI is expected to live in the webapp
|
||||
(standalone app pattern), talking to this extension over Nostr/REST."""
|
||||
|
||||
from fastapi import APIRouter, Depends, Request
|
||||
from fastapi.responses import HTMLResponse
|
||||
from lnbits.core.models import User
|
||||
from lnbits.decorators import check_user_exists
|
||||
from lnbits.helpers import template_renderer
|
||||
|
||||
chatelet_generic_router = APIRouter()
|
||||
|
||||
|
||||
def chatelet_renderer():
|
||||
return template_renderer(["chatelet/templates"])
|
||||
|
||||
|
||||
@chatelet_generic_router.get("/", response_class=HTMLResponse)
|
||||
async def index(request: Request, user: User = Depends(check_user_exists)):
|
||||
return chatelet_renderer().TemplateResponse(
|
||||
"chatelet/index.html", {"request": request, "user": user.json()}
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue