feat: Initialize FastAPI application with Azure authentication and transaction management
- Added .env.example for environment variable configuration. - Created app initialization files and core settings management. - Implemented API routers for reporting and transaction endpoints. - Developed transaction management service with CRUD operations. - Integrated Azure OAuth for user authentication. - Designed dashboard view with transaction filtering and display. - Added Swagger UI documentation with custom dark theme. - Created static and template files for frontend styling and layout.
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
from fastapi import APIRouter, Request
|
||||
from fastapi.openapi.docs import get_swagger_ui_html
|
||||
from fastapi.responses import HTMLResponse
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get("/api/docs", include_in_schema=False)
|
||||
async def swagger_ui_dark(request: Request) -> HTMLResponse:
|
||||
base = get_swagger_ui_html(
|
||||
openapi_url=request.app.openapi_url,
|
||||
title="Recon Ranger — API Docs",
|
||||
swagger_css_url="/static/api/swagger-ui.css",
|
||||
)
|
||||
html = base.body.decode()
|
||||
|
||||
html = html.replace(
|
||||
"</head>",
|
||||
(
|
||||
'<link rel="stylesheet" href="/static/css/styles.css">\n'
|
||||
'<link rel="stylesheet" href="/static/api/swagger-dark.css">\n'
|
||||
"<style>.swagger-ui .topbar { display: none; }</style>\n"
|
||||
"</head>"
|
||||
),
|
||||
)
|
||||
|
||||
nav_html = """
|
||||
<header>
|
||||
<nav>
|
||||
<div class=\"menu\">
|
||||
<div class=\"logo\"><a href=\"/\">Recon Ranger</a></div>
|
||||
<ul>
|
||||
<li><a href=\"/\">Home</a></li>
|
||||
<li><a href=\"/api/docs\">API</a></li>
|
||||
<li><a href=\"mailto:someone@example.com\">Contact</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<div style=\"padding-top:70px; position:relative; z-index:1\">
|
||||
"""
|
||||
html = html.replace("<body>", "<body>" + nav_html)
|
||||
html = html.replace("</body>", "</div></body>")
|
||||
|
||||
return HTMLResponse(html)
|
||||
Reference in New Issue
Block a user