diff options
Diffstat (limited to 'scripts/recipes/handle_recipes.py')
-rw-r--r-- | scripts/recipes/handle_recipes.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/scripts/recipes/handle_recipes.py b/scripts/recipes/handle_recipes.py index 76faf86..22ba0a4 100644 --- a/scripts/recipes/handle_recipes.py +++ b/scripts/recipes/handle_recipes.py @@ -2,7 +2,7 @@ from bson.objectid import ObjectId from scripts.database.mongo import mongo_database from scripts.scraping.scraper import scrape -mongo_collection = mongo_database["recipes"] +mongo_collection = mongo_database.get_collection("recipes") def add_single_recipe(recipe): added_recipe = mongo_collection.insert_one(recipe) @@ -31,6 +31,13 @@ def delete_single_recipe(objectId): except: return {"success": False, "error": "Could not delete recipe"} +def delete_multiple_recipes(user): + try: + mongo_collection.delete_many({"user": user}) + return {"success": True} + except: + return {"success": False} + def search_recipes(query_data, user): query = query_data["q"] facets_list = [] |