refactors

This commit is contained in:
counterweight 2025-12-25 00:59:57 +01:00
parent 139a5fbef3
commit f46d2ae8b3
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
12 changed files with 734 additions and 536 deletions

View file

@ -9,6 +9,7 @@ from sqlalchemy.ext.asyncio import AsyncSession
from database import get_db
from models import Permission, User
from repositories.user import UserRepository
from schemas import UserResponse
SECRET_KEY = os.environ["SECRET_KEY"] # Required - see .env.example
@ -45,8 +46,9 @@ def create_access_token(
async def get_user_by_email(db: AsyncSession, email: str) -> User | None:
result = await db.execute(select(User).where(User.email == email))
return result.scalar_one_or_none()
"""Get user by email (backwards compatibility wrapper)."""
repo = UserRepository(db)
return await repo.get_by_email(email)
async def authenticate_user(db: AsyncSession, email: str, password: str) -> User | None: