Beispiel #1
0
def delete_ingredient(
        ingredient_id: int,
        service: AbstractRecipeService = Depends(create_recipe_service),
        token=Depends(oauth2_scheme),
):
    get_username_from_token(token)
    return service.delete_ingredient(ingredient_id)
Beispiel #2
0
def update_recipe(
        recipe_id: int,
        recipe: RecipeCreate,
        service: AbstractRecipeService = Depends(create_recipe_service),
        token=Depends(oauth2_scheme),
):
    return service.update_recipe(get_username_from_token(token), recipe_id,
                                 recipe)
Beispiel #3
0
def get_ingredients(
        service: AbstractRecipeService = Depends(create_recipe_service),
        token=Depends(oauth2_scheme)):
    get_username_from_token(token)
    return service.get_ingredients()
Beispiel #4
0
def get_recipe_types(
        service: AbstractRecipeService = Depends(create_recipe_service),
        token=Depends(oauth2_scheme)):
    return service.get_recipe_types(get_username_from_token(token))