MCPcopy Create free account
hub / github.com/0010aor/FlashNotes / get_cards

Function get_cards

backend/src/flashcards/services.py:90–103  ·  view source on GitHub ↗
(
    session: Session, collection_id: uuid.UUID, skip: int = 0, limit: int = 100
)

Source from the content-addressed store, hash-verified

88
89
90def 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
106def get_card(session: Session, card_id: uuid.UUID) -> Card | None:

Callers 3

test_get_cardsFunction · 0.90
test_get_cards_skipFunction · 0.90
test_get_cards_emptyFunction · 0.90

Calls

no outgoing calls

Tested by 3

test_get_cardsFunction · 0.72
test_get_cards_skipFunction · 0.72
test_get_cards_emptyFunction · 0.72