Fix startup, settings, imports and more
This commit is contained in:
@@ -11,7 +11,7 @@ class Settings(BaseSettings):
|
||||
PSQL_CONNECT_STR: str | None = None
|
||||
ACCESS_TOKEN_EXPIRE_MIN: int = 30
|
||||
REFRESH_TOKEN_EXPIRE_MIN: int = 60
|
||||
DEFAULT_TIMEZONE = pytz.UTC
|
||||
DEFAULT_TIMEZONE: str = pytz.UTC._tzname
|
||||
|
||||
model_config = SettingsConfigDict(env_file=".env")
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from typing_extensions import Any
|
||||
from tortoise import Tortoise
|
||||
from config import settings
|
||||
from src.config import settings
|
||||
|
||||
db_url = settings.PSQL_CONNECT_STR
|
||||
modules: dict[str, Any] = {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from fastapi import FastAPI
|
||||
from starlette.responses import RedirectResponse
|
||||
from src.config import settings
|
||||
from modules.assets.router import router as asset_router
|
||||
from src.modules.assets.router import router as asset_router
|
||||
from tortoise.contrib.fastapi import register_tortoise
|
||||
from src.database import db_url, modules
|
||||
|
||||
|
||||
@@ -12,10 +12,11 @@ router = APIRouter(prefix="/auth")
|
||||
|
||||
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")
|
||||
|
||||
ACCESS_TOKEN_EXPIRE_MINUTES = settings.ACCESS_TOKEN_EXPIRE_MINUTES
|
||||
ACCESS_TOKEN_EXPIRE_MINUTES = settings.ACCESS_TOKEN_EXPIRE_MIN
|
||||
|
||||
error: str = "E-Mail Address or password is incorrect"
|
||||
|
||||
|
||||
@router.post("/")
|
||||
async def login(email: str, password: str):
|
||||
user: User = await User.get_or_none(email=email)
|
||||
@@ -24,10 +25,12 @@ async def login(email: str, password: str):
|
||||
if user.check_against_password(password) is False:
|
||||
HTTPException(status_code=401, detail=error)
|
||||
|
||||
|
||||
@router.post("/refresh")
|
||||
async def refresh_login():
|
||||
pass
|
||||
|
||||
|
||||
@router.post("/register")
|
||||
async def register():
|
||||
pass
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
aerich==0.8.0
|
||||
fastapi[standard]==0.115.5
|
||||
pydantic-settings==2.7.0
|
||||
tortoise-orm[asyncpg]==0.22.1
|
||||
uvicorn==0.31.1
|
||||
black==24.10.0
|
||||
authlib==1.3.2
|
||||
passlib==1.7.4
|
||||
pytz==2024.2
|
||||
aerich>=0.8.0
|
||||
fastapi[all]>=0.115.5
|
||||
python-dotenv>=0.21.0
|
||||
tortoise-orm[asyncpg]>=0.22.1
|
||||
uvicorn>=0.31.1
|
||||
black>=24.10.0
|
||||
authlib>=1.3.2
|
||||
passlib>=1.7.4
|
||||
pytz>=2024.2
|
||||
Reference in New Issue
Block a user