2022-01-10 12:34:17 +00:00
|
|
|
"""Home routes."""
|
|
|
|
|
|
|
|
from fastapi import APIRouter, Depends, Request
|
|
|
|
|
|
|
|
from members_lumbung_space.dependencies import (
|
|
|
|
get_invites,
|
2022-01-10 15:20:47 +00:00
|
|
|
get_resource_map,
|
2022-01-10 12:34:17 +00:00
|
|
|
get_user,
|
|
|
|
logged_in,
|
|
|
|
)
|
|
|
|
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
|
|
|
|
|
|
@router.get("/", dependencies=[Depends(logged_in)])
|
|
|
|
async def home(
|
2022-01-10 15:20:47 +00:00
|
|
|
request: Request,
|
|
|
|
user=Depends(get_user),
|
|
|
|
invites=Depends(get_invites),
|
|
|
|
resource_map=Depends(get_resource_map),
|
2022-01-10 12:34:17 +00:00
|
|
|
):
|
2022-01-10 15:20:47 +00:00
|
|
|
context = {
|
|
|
|
"request": request,
|
|
|
|
"user": user,
|
|
|
|
"invites": invites,
|
|
|
|
"resource_map": resource_map,
|
|
|
|
}
|
|
|
|
|
2022-01-13 14:04:24 +00:00
|
|
|
request.app.state.templates.env.filters["zip"] = zip
|
2022-01-10 12:34:17 +00:00
|
|
|
return request.app.state.templates.TemplateResponse(
|
|
|
|
"admin.html", context=context
|
|
|
|
)
|
2022-01-13 08:06:46 +00:00
|
|
|
|
|
|
|
@router.get("/invites", dependencies=[Depends(logged_in)])
|
|
|
|
async def invites(
|
|
|
|
request: Request,
|
|
|
|
user=Depends(get_user),
|
|
|
|
invites=Depends(get_invites),
|
|
|
|
):
|
|
|
|
context = {
|
|
|
|
"request": request,
|
|
|
|
"user": user,
|
|
|
|
"invites": invites,
|
|
|
|
}
|
|
|
|
|
|
|
|
return request.app.state.templates.TemplateResponse(
|
|
|
|
"invites.html", context=context
|
|
|
|
)
|