refactors
This commit is contained in:
parent
139a5fbef3
commit
f46d2ae8b3
12 changed files with 734 additions and 536 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue