(
session: Session, collection_id: uuid.UUID, skip: int = 0, limit: int = 100
)
| 88 | |
| 89 | |
| 90 | def get_cards( |
| 91 | session: Session, collection_id: uuid.UUID, skip: int = 0, limit: int = 100 |
| 92 | ) -> tuple[list[Card], int]: |
| 93 | count_statement = select(func.count()).where(Card.collection_id == collection_id) |
| 94 | count = session.exec(count_statement).one() |
| 95 | statement = ( |
| 96 | select(Card) |
| 97 | .where(Card.collection_id == collection_id) |
| 98 | .order_by(Card.updated_at.desc()) |
| 99 | .offset(skip) |
| 100 | .limit(limit) |
| 101 | ) |
| 102 | cards = session.exec(statement).all() |
| 103 | return cards, count |
| 104 | |
| 105 | |
| 106 | def get_card(session: Session, card_id: uuid.UUID) -> Card | None: |
no outgoing calls