from sqlalchemy import select from app.models.admin import Admin from app.repositories.base import BaseRepository class AdminRepository(BaseRepository[Admin]): def __init__(self, session): super().__init__(session, Admin) async def get_by_telegram_id(self, telegram_id: int) -> Admin | None: stmt = select(Admin).where(Admin.telegram_id == telegram_id) result = await self.session.execute(stmt) return result.scalar_one_or_none() async def get_active_admins(self) -> list[Admin]: stmt = select(Admin).where(Admin.is_active.is_(True)) result = await self.session.execute(stmt) return list(result.scalars().all())