2025-09-21 00:09:19 -04:00
|
|
|
#!/bin/env python3
|
|
|
|
|
|
|
|
|
|
from fastapi import FastAPI
|
|
|
|
|
from sys import argv
|
2025-09-28 22:53:09 -04:00
|
|
|
from exceptions import bad_key
|
|
|
|
|
|
|
|
|
|
from repos.api_keys import ApiKeyRepo
|
2025-09-21 00:09:19 -04:00
|
|
|
|
|
|
|
|
from routers.prefixes import prefix_router
|
2025-09-23 22:20:53 -04:00
|
|
|
from routers.tickets import ticket_router
|
2025-09-25 23:11:52 -04:00
|
|
|
from routers.baskets import basket_router
|
|
|
|
|
from routers.combined import combined_router
|
2025-09-27 16:46:30 -04:00
|
|
|
from routers.reports import report_router
|
2025-09-27 23:09:19 -04:00
|
|
|
from routers.backuprestore import backup_router
|
2025-09-28 16:57:03 -04:00
|
|
|
from routers.counts import counts_router
|
2025-09-21 00:09:19 -04:00
|
|
|
|
|
|
|
|
if argv[1] == "run":
|
|
|
|
|
app = FastAPI(title="TAM3 API Server", docs_url=None, redoc_url=None)
|
|
|
|
|
else:
|
|
|
|
|
app = FastAPI(title="TAM3 API Server")
|
|
|
|
|
|
2025-09-28 22:53:09 -04:00
|
|
|
@app.get("/api/")
|
|
|
|
|
def remote_check(api_key: str = ""):
|
|
|
|
|
if not ApiKeyRepo().check_api(api_key):
|
|
|
|
|
return {"status": "healthy", "auth": False, "whoami": "TAM3 Server"}
|
|
|
|
|
return {"status": "healthy", "auth": True, "whoami": "TAM3 Server"}
|
|
|
|
|
|
2025-09-21 00:09:19 -04:00
|
|
|
app.include_router(prefix_router)
|
2025-09-25 23:11:52 -04:00
|
|
|
app.include_router(ticket_router)
|
|
|
|
|
app.include_router(basket_router)
|
2025-09-27 16:46:30 -04:00
|
|
|
app.include_router(combined_router)
|
2025-09-27 23:09:19 -04:00
|
|
|
app.include_router(report_router)
|
2025-09-28 16:57:03 -04:00
|
|
|
app.include_router(backup_router)
|
|
|
|
|
app.include_router(counts_router)
|