diff --git a/api/kiwi_vpn_api/db/create_db.py b/api/kiwi_vpn_api/db/create_db.py index c572ee8..db01ab9 100755 --- a/api/kiwi_vpn_api/db/create_db.py +++ b/api/kiwi_vpn_api/db/create_db.py @@ -1,8 +1,7 @@ #!/usr/bin/env python3 -from kiwi_vpn_api.config import CRYPT_CONTEXT, DB -from kiwi_vpn_api.db.model import (Certificate, DistinguishedName, User, - UserCapability) +from ..config import CRYPT_CONTEXT, DB +from .model import Certificate, DistinguishedName, User, UserCapability def main(): diff --git a/api/kiwi_vpn_api/db/model.py b/api/kiwi_vpn_api/db/model.py index f409729..eae5ba1 100644 --- a/api/kiwi_vpn_api/db/model.py +++ b/api/kiwi_vpn_api/db/model.py @@ -3,10 +3,11 @@ from __future__ import annotations import datetime from typing import Optional -from kiwi_vpn_api.config import CRYPT_CONTEXT, DB from peewee import (BooleanField, CharField, DateTimeField, ForeignKeyField, Model) +from ..config import CRYPT_CONTEXT, DB + class BaseModel(Model): class Meta: diff --git a/api/kiwi_vpn_api/main.py b/api/kiwi_vpn_api/main.py index d56d130..5c540fc 100755 --- a/api/kiwi_vpn_api/main.py +++ b/api/kiwi_vpn_api/main.py @@ -3,8 +3,8 @@ import uvicorn from fastapi import FastAPI -from kiwi_vpn_api.config import PRODUCTION_MODE -from kiwi_vpn_api.routers import auth, user +from .config import PRODUCTION_MODE +from .routers import auth, user api = FastAPI( title="kiwi-vpn API", diff --git a/api/kiwi_vpn_api/routers/auth.py b/api/kiwi_vpn_api/routers/auth.py index ac11009..fafa35b 100644 --- a/api/kiwi_vpn_api/routers/auth.py +++ b/api/kiwi_vpn_api/routers/auth.py @@ -3,11 +3,12 @@ from datetime import datetime, timedelta from fastapi import APIRouter, Depends, HTTPException, status from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm from jose import jwt -from kiwi_vpn_api.config import (ACCESS_TOKEN_EXPIRE_MINUTES, ALGORITHM, - CRYPT_CONTEXT, SECRET_KEY) -from kiwi_vpn_api.db.model import User from pydantic import BaseModel +from ..config import (ACCESS_TOKEN_EXPIRE_MINUTES, ALGORITHM, CRYPT_CONTEXT, + SECRET_KEY) +from ..db.model import User + router = APIRouter(prefix="/auth") SCHEME = OAuth2PasswordBearer( tokenUrl=f".{router.prefix}/token" diff --git a/api/kiwi_vpn_api/routers/user.py b/api/kiwi_vpn_api/routers/user.py index b768788..50db0e7 100644 --- a/api/kiwi_vpn_api/routers/user.py +++ b/api/kiwi_vpn_api/routers/user.py @@ -4,11 +4,12 @@ from typing import Optional from fastapi import APIRouter, Depends, HTTPException, status from jose import JWTError, jwt -from kiwi_vpn_api.routers.auth import SCHEME -from kiwi_vpn_api.config import ALGORITHM, SECRET_KEY -from kiwi_vpn_api.db.model import User as db_User from pydantic import BaseModel +from ..config import ALGORITHM, SECRET_KEY +from ..db.model import User as db_User +from .auth import SCHEME + router = APIRouter(prefix="/user")