示例#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)
示例#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)
示例#3
0
def get_ingredients(
        service: AbstractRecipeService = Depends(create_recipe_service),
        token=Depends(oauth2_scheme)):
    get_username_from_token(token)
    return service.get_ingredients()
示例#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))