Enhance backend functionality and frontend UI
- Updated main.py to include authentication for brand, model, and OTA routers. - Added new OTA schemas in schemas.py for version management. - Enhanced model retrieval with sorting options in models.py. - Improved model update functionality to support multipart/form-data uploads. - Updated frontend layout and styles for a more modern look, including new font integration. - Implemented login route and authentication checks in router/index.js. - Added sorting capabilities in model table and improved file handling in model view. - Updated requirements.txt to include PyJWT for token management.
This commit is contained in:
+9
-5
@@ -1,11 +1,13 @@
|
||||
from fastapi import FastAPI
|
||||
from fastapi import FastAPI, Depends
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
import os
|
||||
import logging
|
||||
from dotenv import load_dotenv
|
||||
|
||||
from database import engine, Base
|
||||
from routes import brands_router, models_router
|
||||
from routes import brands_router, models_router, ota_router
|
||||
from routes.auth import router as auth_router
|
||||
from security import get_current_user
|
||||
|
||||
# Load environment variables
|
||||
load_dotenv()
|
||||
@@ -46,9 +48,11 @@ app.add_middleware(
|
||||
allow_headers=["*"],
|
||||
)
|
||||
|
||||
# Include routers
|
||||
app.include_router(brands_router)
|
||||
app.include_router(models_router)
|
||||
# Include routers(业务接口需登录;登录接口除外)
|
||||
app.include_router(auth_router)
|
||||
app.include_router(brands_router, dependencies=[Depends(get_current_user)])
|
||||
app.include_router(models_router, dependencies=[Depends(get_current_user)])
|
||||
app.include_router(ota_router, dependencies=[Depends(get_current_user)])
|
||||
|
||||
|
||||
@app.get("/")
|
||||
|
||||
Reference in New Issue
Block a user