Source code for election_day.collections.ballots

from __future__ import annotations

from onegov.election_day.models import Ballot


from typing import TYPE_CHECKING
if TYPE_CHECKING:
    from sqlalchemy.orm import Query, Session
    from uuid import UUID


[docs] class BallotCollection: def __init__(self, session: Session):
[docs] self.session = session
[docs] def query(self) -> Query[Ballot]: return self.session.query(Ballot)
[docs] def by_id(self, id: UUID) -> Ballot | None: return self.query().filter(Ballot.id == id).first()