diff --git a/cookie_api/__init__.py b/cookie_api/__init__.py index 3565ea8..c62c7e5 100644 --- a/cookie_api/__init__.py +++ b/cookie_api/__init__.py @@ -1,3 +1,3 @@ from cookie_api.renders import JSONRenderer -from cookie_api.models.schema import Base -from cookie_api.app import application_factory \ No newline at end of file +from cookie_api.app import application_factory +from cookie_api.models import Base \ No newline at end of file diff --git a/cookie_api/app.py b/cookie_api/app.py index 6d981cf..3753ed0 100644 --- a/cookie_api/app.py +++ b/cookie_api/app.py @@ -4,13 +4,10 @@ from apistar.backends.sqlalchemy_backend import Session from apistar.frameworks.wsgi import WSGIApp as App from apistar.handlers import docs_urls, static_urls from apistar.interfaces import Router, Injector, Auth - from apistar_jwt.authentication import JWTAuthentication - -from cookie_api.commands import commands -from cookie_api.models.schema import Cookie - from cookie_api.auth import auth_routes, auth_components +from cookie_api.commands import commands +from cookie_api.models import Cookie @annotate(authentication=[JWTAuthentication()]) diff --git a/cookie_api/auth.py b/cookie_api/auth.py index 2e7e5c5..5be12a7 100644 --- a/cookie_api/auth.py +++ b/cookie_api/auth.py @@ -1,10 +1,10 @@ import datetime as dt + from apistar import Component, Settings, http, Route, Include from apistar.backends.sqlalchemy_backend import Session from apistar_jwt.authentication import get_jwt from apistar_jwt.token import JWT - -from .models.schema import User +from cookie_api.models import User # /auth/register # /auth/user @@ -14,7 +14,7 @@ from .models.schema import User auth_components = [ Component(JWT, init=get_jwt) ] - +[] # /auth/login def login(settings: Settings, json_data: http.RequestData, session: Session): diff --git a/cookie_api/commands.py b/cookie_api/commands.py index b0c7d53..2341457 100644 --- a/cookie_api/commands.py +++ b/cookie_api/commands.py @@ -1,7 +1,7 @@ from apistar import Command from apistar.backends.sqlalchemy_backend import Session -from cookie_api.models.schema import User +from cookie_api.models import User def create_user(session: Session, email, password): diff --git a/cookie_api/models/schema.py b/cookie_api/models.py similarity index 100% rename from cookie_api/models/schema.py rename to cookie_api/models.py diff --git a/cookie_api/models/__init__.py b/cookie_api/models/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/cookie_api/models/types.py b/cookie_api/types.py similarity index 100% rename from cookie_api/models/types.py rename to cookie_api/types.py