mirror of
https://github.com/dat515-2025/Group-8.git
synced 2026-03-22 15:12:08 +01:00
refactor(backend): refactor project, add database migrations support
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user