Skip to content

Commit 3b50c0f

Browse files
committed
Move current routers to the 'old' namespace
This is to indicate that they purely exist for backwards compatibility
1 parent 615104f commit 3b50c0f

File tree

9 files changed

+24
-161
lines changed

9 files changed

+24
-161
lines changed

api/main.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from starlette.middleware.authentication import AuthenticationMiddleware
33

44
from api.middleware import TokenAuthentication, on_auth_error
5-
from api.routers import codejams, infractions, teams, users, winners
5+
from api.routers.old import old_routes_router
66
from api.settings import Server
77

88
app = FastAPI(redoc_url="/", docs_url="/swagger")
@@ -13,8 +13,4 @@
1313
on_error=on_auth_error,
1414
)
1515

16-
app.include_router(codejams.router)
17-
app.include_router(infractions.router)
18-
app.include_router(teams.router)
19-
app.include_router(users.router)
20-
app.include_router(winners.router)
16+
app.include_router(old_routes_router)

api/models.py

Lines changed: 0 additions & 146 deletions
This file was deleted.

api/routers/__init__.py

Whitespace-only changes.

api/routers/old/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from fastapi import APIRouter
2+
3+
from api.routers.old import codejams, infractions, teams, users, winners
4+
5+
old_routes_router = APIRouter()
6+
old_routes_router.include_router(codejams.router)
7+
old_routes_router.include_router(infractions.router)
8+
old_routes_router.include_router(teams.router)
9+
old_routes_router.include_router(users.router)
10+
old_routes_router.include_router(winners.router)

api/routers/codejams.py renamed to api/routers/old/codejams.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
from sqlalchemy import desc, update
55
from sqlalchemy.future import select
66

7-
from api.database import DBSession, Jam, Team, TeamUser, User
87
from api.models import CodeJam, CodeJamResponse
8+
from api.models.orm import Jam, Team, User
9+
from api.settings import DBSession
910

1011
router = APIRouter(prefix="/codejams", tags=["codejams"])
1112

api/routers/infractions.py renamed to api/routers/old/infractions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
from fastapi import APIRouter, HTTPException
22
from sqlalchemy.future import select
33

4-
from api.database import DBSession
5-
from api.database import Infraction as DbInfraction
6-
from api.database import Jam, User
74
from api.models import Infraction, InfractionResponse
5+
from api.models.orm import Infraction as DbInfraction
6+
from api.models.orm import Jam, User
7+
from api.settings import DBSession
88

99
router = APIRouter(prefix="/infractions", tags=["infractions"])
1010

api/routers/teams.py renamed to api/routers/old/teams.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
from sqlalchemy.ext.asyncio import AsyncSession
66
from sqlalchemy.future import select
77

8-
from api.database import DBSession, Jam, Team, TeamUser
9-
from api.database import User as DbUser
108
from api.models import TeamResponse, User
9+
from api.models.orm import Jam, Team
10+
from api.models.orm import User as DbUser
11+
from api.settings import DBSession
1112

1213
router = APIRouter(prefix="/teams", tags=["teams"])
1314

api/routers/users.py renamed to api/routers/old/users.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
from sqlalchemy.ext.asyncio import AsyncSession
55
from sqlalchemy.future import select
66

7-
from api.database import DBSession, Jam, TeamUser, User
87
from api.models import UserResponse, UserTeamResponse
8+
from api.models.orm import Jam, User
9+
from api.settings import DBSession
910

1011
router = APIRouter(prefix="/users", tags=["users"])
1112

api/routers/winners.py renamed to api/routers/old/winners.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
from sqlalchemy import func
33
from sqlalchemy.future import select
44

5-
from api.database import DBSession, Jam, User
6-
from api.database import Winner as DbWinner
75
from api.models import Winner, WinnerResponse
6+
from api.models.orm import Jam, User
7+
from api.settings import DBSession
88

99
router = APIRouter(prefix="/winners", tags=["winners"])
1010

0 commit comments

Comments
 (0)