Coverage for src/cstlcore/collections/dependencies.py: 90%
10 statements
« prev ^ index » next coverage.py v7.9.1, created at 2026-02-19 12:46 +0000
« prev ^ index » next coverage.py v7.9.1, created at 2026-02-19 12:46 +0000
1import uuid
3from fastapi import Depends, HTTPException
4from sqlmodel import Session
6from cstlcore.collections.models import Collection
7from cstlcore.database.dependencies import get_session
10def get_existing_collection(
11 collection_id: uuid.UUID,
12 session: Session = Depends(get_session),
13) -> Collection:
14 collection = session.get(Collection, collection_id)
15 if not collection:
16 raise HTTPException(status_code=404, detail="Collection not found")
17 return collection