feat: initialize aivideo project
This commit is contained in:
24
backend/app/modules/auth/repository.py
Normal file
24
backend/app/modules/auth/repository.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from sqlalchemy import or_, select
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.models.entities import User
|
||||
|
||||
|
||||
class AuthRepository:
|
||||
def __init__(self, db: Session) -> None:
|
||||
self.db = db
|
||||
|
||||
def get_user_by_account(self, account: str) -> User | None:
|
||||
return self.db.scalar(
|
||||
select(User).where(
|
||||
or_(
|
||||
User.email == account,
|
||||
User.mobile == account,
|
||||
User.username == account,
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
def get_user_by_public_id(self, public_id: str) -> User | None:
|
||||
return self.db.scalar(select(User).where(User.public_id == public_id))
|
||||
|
||||
Reference in New Issue
Block a user