示例#1
0
def update_theme(theme_name: str,
                 data: SiteTheme,
                 session: Session = Depends(generate_session)):
    """ Update a theme database entry """
    db.themes.update(session, theme_name, data.dict())

    return SnackResponse.info(f"Theme Updated: {theme_name}")
示例#2
0
def update_meal_plan(plan_id: str,
                     meal_plan: MealPlan,
                     session: Session = Depends(generate_session)):
    """ Updates a meal plan based off ID """
    meal_plan.process_meals(session)
    meal_plan.update(session, plan_id)

    return SnackResponse.info("Mealplan Updated")
示例#3
0
async def delete_migration_data(file_folder_name: str):
    """ Removes migration data from the file system """

    remove_path = MIGRATION_DIR.joinpath(file_folder_name)

    if remove_path.is_file():
        remove_path.unlink()
    elif remove_path.is_dir():
        shutil.rmtree(remove_path)
    else:
        SnackResponse.error("File/Folder not found.")

    return SnackResponse.info(f"Migration Data Remove: {remove_path.absolute()}")