extract SQLAlchemy model in separate python library

This commit is contained in:
Thomas Peetz
2026-08-14 16:39:46 +02:00
parent 9f0a0c1d1e
commit 48149b67cf
148 changed files with 1195 additions and 1062 deletions
+5 -5
View File
@@ -15,15 +15,15 @@ from pydantic import ValidationError
from src.core.config import settings
from src.core.log_conf import logger
from src.db.models.admin import Profile
from src.db.repository.admin import (
from kontor_model.db.models.admin import Profile
from kontor_model.db.repository.admin import (
get_profile_by_username,
get_profile_by_email,
is_database_empty,
)
from src.db.session import SessionLocal
from src.schema.admin.token import TokenData
from src.schema.user.profile import ProfileModel, to_model
from kontor_model.schema.admin.token import TokenData
from kontor_model.schema.user.profile import ProfileModel, to_model
oauth2_scheme = OAuth2PasswordBearer(
tokenUrl="/token",
@@ -163,7 +163,7 @@ async def get_current_user(
async def get_current_active_user(
current_user: Annotated[Profile, Security(get_current_user, scopes=["me"])],
) -> ProfileModel:
if not current_user.enabled:
if not bool(current_user.enabled):
raise HTTPException(status_code=400, detail="Inactive user")
user_model = to_model(current_user)
return user_model