Spaces:
Build error
Build error
File size: 507 Bytes
edda8af | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | from sqlmodel import select
from src.api.models.user import User
from sqlmodel.ext.asyncio.session import AsyncSession
from typing import Optional
async def get_user_by_email(email: str, db: AsyncSession) -> Optional[User]:
email = email.lower()
result = await db.exec(select(User).where(User.email == email))
return result.first()
async def get_user_by_id(id: int, db: AsyncSession) -> Optional[User]:
result = await db.exec(select(User).where(User.id == id))
return result.first()
|