Example #1
0
def update_keyword(
        *,
        _: bool = Depends(is_authenticated),
        repository: KeywordRepository = Depends(get_keyword_repository),
        id: int,
        keyword_update: KeywordUpdate):
    db_keyword: DBKeyword = or_404(repository.get(id))
    updated: DBKeyword = repository.update(
        db_keyword, keyword_update.dict(skip_defaults=True))
    return updated
Example #2
0
def update_keyword(
    *,
    _: bool = Depends(is_authenticated),
    repository: KeywordRepository = Depends(get_keyword_repository),
    id: int,
    keyword_update: KeywordUpdate,
):
    db_keyword: DBKeyword = or_404(repository.get(id))
    updated: DBKeyword = repository.update(
        db_keyword, keyword_update.dict(exclude_unset=True))
    return updated.to_model()