Browse Source

Format fixes and delete two unused routers

highing666 3 years ago
parent
commit
25ac2bc44a
1 changed files with 35 additions and 19 deletions
  1. 35 19
      app/main.py

+ 35 - 19
app/main.py

@@ -7,7 +7,16 @@ import uvicorn
 from fastapi import FastAPI
 from loguru import logger
 
-from app.api.routers import algorithms, targets, equipment, space, item, user, bluetooth, devices, nlp, positioning
+from app.api.routers import (
+    algorithms,
+    targets,
+    equipment,
+    space,
+    bluetooth,
+    devices,
+    nlp,
+    positioning,
+)
 from app.api.routers.model_path import early_start
 from app.core.config import settings
 from app.core.events import create_start_app_handler
@@ -17,30 +26,37 @@ from app.db.session import Base, engine
 Base.metadata.create_all(bind=engine)
 
 logging.getLogger().handlers = [InterceptHandler()]
-logger.add(Path(settings.LOGS_DIR, 'env_fastapi.log'), level='INFO', rotation='00:00', encoding='utf-8')
+logger.add(
+    Path(settings.LOGS_DIR, "env_fastapi.log"),
+    level="INFO",
+    rotation="00:00",
+    encoding="utf-8",
+)
 
 
 def get_application() -> FastAPI:
-    application = FastAPI(title=settings.PROJECT_NAME, root_path='/env-py')
-
-    application.add_event_handler('startup', create_start_app_handler())
-
-    application.include_router(algorithms.router, prefix='/algo', tags=['Algorithms'])
-    application.include_router(bluetooth.router, prefix='/bluetooth', tags=['BLE'])
-    application.include_router(devices.router, prefix='/devices', tags=['Devices'])
-    application.include_router(early_start.router, prefix='/model-path', tags=['Model Path'])
-    application.include_router(equipment.router, prefix='/equip', tags=['Equipment'])
-    application.include_router(item.router, prefix='/items', tags=['Items'])
-    application.include_router(nlp.router, prefix='/nlp-service', tags=['NLP'])
-    application.include_router(positioning.router, prefix='/positioning-service', tags=['Positioning Service'])
-    application.include_router(space.router, prefix='/room', tags=['Spaces'])
-    application.include_router(targets.router, prefix='/target', tags=['Targets'])
-    application.include_router(user.router, prefix='/users', tags=['Users'])
+    application = FastAPI(title=settings.PROJECT_NAME, root_path="/env-py")
+
+    application.add_event_handler("startup", create_start_app_handler())
+
+    application.include_router(algorithms.router, prefix="/algo", tags=["Algorithms"])
+    application.include_router(bluetooth.router, prefix="/bluetooth", tags=["BLE"])
+    application.include_router(devices.router, prefix="/devices", tags=["Devices"])
+    application.include_router(
+        early_start.router, prefix="/model-path", tags=["Model Path"]
+    )
+    application.include_router(equipment.router, prefix="/equip", tags=["Equipment"])
+    application.include_router(nlp.router, prefix="/nlp-service", tags=["NLP"])
+    application.include_router(
+        positioning.router, prefix="/positioning-service", tags=["Positioning Service"]
+    )
+    application.include_router(space.router, prefix="/room", tags=["Spaces"])
+    application.include_router(targets.router, prefix="/target", tags=["Targets"])
 
     return application
 
 
 app = get_application()
 
-if __name__ == '__main__':
-    uvicorn.run(app, host='0.0.0.0', port=8000)
+if __name__ == "__main__":
+    uvicorn.run(app, host="0.0.0.0", port=8000)