relative imports
This commit is contained in:
parent
18b1cb21f9
commit
411c584480
5 changed files with 14 additions and 12 deletions
|
@ -1,8 +1,7 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
from kiwi_vpn_api.config import CRYPT_CONTEXT, DB
|
from ..config import CRYPT_CONTEXT, DB
|
||||||
from kiwi_vpn_api.db.model import (Certificate, DistinguishedName, User,
|
from .model import Certificate, DistinguishedName, User, UserCapability
|
||||||
UserCapability)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
|
@ -3,10 +3,11 @@ from __future__ import annotations
|
||||||
import datetime
|
import datetime
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from kiwi_vpn_api.config import CRYPT_CONTEXT, DB
|
|
||||||
from peewee import (BooleanField, CharField, DateTimeField, ForeignKeyField,
|
from peewee import (BooleanField, CharField, DateTimeField, ForeignKeyField,
|
||||||
Model)
|
Model)
|
||||||
|
|
||||||
|
from ..config import CRYPT_CONTEXT, DB
|
||||||
|
|
||||||
|
|
||||||
class BaseModel(Model):
|
class BaseModel(Model):
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
import uvicorn
|
import uvicorn
|
||||||
from fastapi import FastAPI
|
from fastapi import FastAPI
|
||||||
|
|
||||||
from kiwi_vpn_api.config import PRODUCTION_MODE
|
from .config import PRODUCTION_MODE
|
||||||
from kiwi_vpn_api.routers import auth, user
|
from .routers import auth, user
|
||||||
|
|
||||||
api = FastAPI(
|
api = FastAPI(
|
||||||
title="kiwi-vpn API",
|
title="kiwi-vpn API",
|
||||||
|
|
|
@ -3,11 +3,12 @@ from datetime import datetime, timedelta
|
||||||
from fastapi import APIRouter, Depends, HTTPException, status
|
from fastapi import APIRouter, Depends, HTTPException, status
|
||||||
from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
|
from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
|
||||||
from jose import jwt
|
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 pydantic import BaseModel
|
||||||
|
|
||||||
|
from ..config import (ACCESS_TOKEN_EXPIRE_MINUTES, ALGORITHM, CRYPT_CONTEXT,
|
||||||
|
SECRET_KEY)
|
||||||
|
from ..db.model import User
|
||||||
|
|
||||||
router = APIRouter(prefix="/auth")
|
router = APIRouter(prefix="/auth")
|
||||||
SCHEME = OAuth2PasswordBearer(
|
SCHEME = OAuth2PasswordBearer(
|
||||||
tokenUrl=f".{router.prefix}/token"
|
tokenUrl=f".{router.prefix}/token"
|
||||||
|
|
|
@ -4,11 +4,12 @@ from typing import Optional
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends, HTTPException, status
|
from fastapi import APIRouter, Depends, HTTPException, status
|
||||||
from jose import JWTError, jwt
|
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 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")
|
router = APIRouter(prefix="/user")
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue