17 lines
487 B
Python
17 lines
487 B
Python
from typing import Optional
|
|
|
|
from sqlalchemy import select
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
|
|
from app.domain.models import ContestStatus
|
|
|
|
|
|
class ContestStatusesRepository:
|
|
def __init__(self, db: AsyncSession):
|
|
self.db = db
|
|
|
|
async def get_by_id(self, contest_status_id: int) -> Optional[ContestStatus]:
|
|
stmt = select(ContestStatus).filter_by(id=contest_status_id)
|
|
result = await self.db.execute(stmt)
|
|
return result.scalars().first()
|