(
session: Session, user_id: uuid.UUID, skip: int = 0, limit: int = 100
)
| 23 | |
| 24 | |
| 25 | def get_collections( |
| 26 | session: Session, user_id: uuid.UUID, skip: int = 0, limit: int = 100 |
| 27 | ) -> tuple[list[Collection], int]: |
| 28 | count_statement = select(func.count()).where(Collection.user_id == user_id) |
| 29 | count = session.exec(count_statement).one() |
| 30 | statement = ( |
| 31 | select(Collection) |
| 32 | .where(Collection.user_id == user_id) |
| 33 | .order_by(Collection.updated_at.desc()) |
| 34 | .offset(skip) |
| 35 | .limit(limit) |
| 36 | ) |
| 37 | collections = session.exec(statement).all() |
| 38 | return collections, count |
| 39 | |
| 40 | |
| 41 | def get_collection( |
no outgoing calls