refactor(backend): refactor project, add database migrations support

This commit is contained in:
2025-09-24 19:42:04 +02:00
parent b880670929
commit 3c8ad5f74f
33 changed files with 408 additions and 77 deletions

View File

@@ -1,9 +1,10 @@
from fastapi import Depends, FastAPI
from fastapi.middleware.cors import CORSMiddleware
from .db import User, create_db_and_tables
from .schemas import UserCreate, UserRead, UserUpdate
from .users import auth_backend, current_active_verified_user, fastapi_users
from app.models.user import User
from app.schemas.user import UserCreate, UserRead, UserUpdate
from app.services.user_service import auth_backend, current_active_verified_user, fastapi_users
app = FastAPI()
@@ -53,9 +54,3 @@ async def root():
@app.get("/authenticated-route")
async def authenticated_route(user: User = Depends(current_active_verified_user)):
return {"message": f"Hello {user.email}!"}
@app.on_event("startup")
async def on_startup():
# Not needed if you setup a migration system like Alembic
await create_db_and_tables()