| | ```python |
| | from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession |
| | from sqlalchemy.orm import sessionmaker |
| | from models.escalation_models import EscalationTicket, TicketResponse |
| | import os |
| |
|
| | engine = create_async_engine(os.getenv("POSTGRES_URL")) |
| | AsyncSessionLocal = sessionmaker(engine, class_=AsyncSession, expire_on_commit=False) |
| |
|
| | class PostgresService: |
| | async def create_ticket(self, ticket: EscalationTicket) -> int: |
| | async with AsyncSessionLocal() as session: |
| | |
| | pass |
| | |
| | async def get_tickets(self, status: str = None) -> list[TicketResponse]: |
| | async with AsyncSessionLocal() as session: |
| | |
| | pass |
| | ``` |