コード例 #1
0
def create_collection(
        *,
        _: bool = Depends(is_authenticated),
        repository: CollectionRepository = Depends(get_collection_repository),
        collection: CollectionUpdate):
    db_collection: DBCollection = DBCollection(**collection.dict())
    return repository.add(db_collection)
コード例 #2
0
def create_collection(
    *,
    _: bool = Depends(is_authenticated),
    repository: CollectionRepository = Depends(get_collection_repository),
    collection: CollectionUpdate,
):
    db_collection: DBCollection = repository.add(
        DBCollection.create(collection))
    return db_collection.to_model()