From 4ddb571ded058995133d54ef58ee43c2c0ff5c6b Mon Sep 17 00:00:00 2001 From: grillazz Date: Sat, 31 Jul 2021 12:51:00 +0200 Subject: [PATCH] flake8 fixes --- the_app/api/nonsense.py | 2 +- the_app/api/stuff.py | 2 +- the_app/main.py | 6 +++--- the_app/models/__init__.py | 4 ++-- the_app/models/base.py | 1 + 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/the_app/api/nonsense.py b/the_app/api/nonsense.py index 8f6ca2b..410cb40 100644 --- a/the_app/api/nonsense.py +++ b/the_app/api/nonsense.py @@ -5,7 +5,7 @@ from the_app.database import get_db from the_app.models.nonsense import Nonsense from the_app.schemas.nnonsense import NonsenseResponse, NonsenseSchema -router = APIRouter() +router = APIRouter(prefix="/v1/nonsense") @router.post("/", status_code=status.HTTP_201_CREATED, response_model=NonsenseResponse) diff --git a/the_app/api/stuff.py b/the_app/api/stuff.py index 9ce194c..fa45e1e 100644 --- a/the_app/api/stuff.py +++ b/the_app/api/stuff.py @@ -5,7 +5,7 @@ from the_app.database import get_db from the_app.models.stuff import Stuff from the_app.schemas.stuff import StuffResponse, StuffSchema -router = APIRouter() +router = APIRouter(prefix="/v1/stuff") @router.post("/", status_code=status.HTTP_201_CREATED, response_model=StuffResponse) diff --git a/the_app/main.py b/the_app/main.py index 06ac205..338f14c 100644 --- a/the_app/main.py +++ b/the_app/main.py @@ -9,10 +9,10 @@ from the_app.models.base import Base log = logging.getLogger(__name__) -app = FastAPI(title="Stuff And Nonsense", version="0.1") +app = FastAPI(title="Stuff And Nonsense", version="0.2") -app.include_router(stuff_router, prefix="/v1") -app.include_router(nonsense_router, prefix="/v1") +app.include_router(stuff_router) +app.include_router(nonsense_router) async def start_db(): diff --git a/the_app/models/__init__.py b/the_app/models/__init__.py index 9b56a8a..9a6ae8f 100644 --- a/the_app/models/__init__.py +++ b/the_app/models/__init__.py @@ -1,2 +1,2 @@ -from the_app.models.nonsense import Nonsense -from the_app.models.stuff import Stuff +from the_app.models.nonsense import Nonsense # noqa +from the_app.models.stuff import Stuff # noqa diff --git a/the_app/models/base.py b/the_app/models/base.py index 21d913f..b386b91 100644 --- a/the_app/models/base.py +++ b/the_app/models/base.py @@ -11,6 +11,7 @@ class Base: id: Any __name__: str # Generate __tablename__ automatically + @declared_attr def __tablename__(cls) -> str: return cls.__name__.lower()