added child endpoint, ability to add and edit child as well as auto redirect to add-child page when user without child accesses home page
This commit is contained in:
@@ -12,6 +12,7 @@ from fastapi.staticfiles import StaticFiles
|
||||
from baby_monitor.routers.auth import router as auth_router
|
||||
from baby_monitor.routers.auth import verify_token
|
||||
from baby_monitor.routers.admin import router as admin_router
|
||||
from baby_monitor.routers.child import router as child_router
|
||||
from baby_monitor.routers.health import router as health_router
|
||||
from baby_monitor.repositories.dependencies.get_database import init_db
|
||||
|
||||
@@ -47,6 +48,7 @@ app.mount("/static", StaticFiles(directory=str(static_path)), name="static")
|
||||
# Include routers
|
||||
app.include_router(auth_router)
|
||||
app.include_router(admin_router)
|
||||
app.include_router(child_router)
|
||||
app.include_router(health_router)
|
||||
|
||||
|
||||
@@ -75,6 +77,12 @@ def serve_admin() -> FileResponse:
|
||||
return FileResponse(static_path / "admin.html")
|
||||
|
||||
|
||||
@app.get("/add-child.html", include_in_schema=False)
|
||||
def serve_add_child() -> FileResponse:
|
||||
"""Serve the add child page."""
|
||||
return FileResponse(static_path / "add-child.html")
|
||||
|
||||
|
||||
@app.get("/api/")
|
||||
def read_root(token: Annotated[str, Depends(verify_token)]) -> dict:
|
||||
"""API root endpoint (requires authentication)."""
|
||||
|
||||
Reference in New Issue
Block a user