From d518beb637e7c2776d84e87c63cc201c101ca89c Mon Sep 17 00:00:00 2001 From: JJ Date: Sun, 30 Mar 2025 20:56:01 +0100 Subject: styling, sub instructions --- scripts/recipes/handle_recipes.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'scripts/recipes') 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 = [] -- cgit v1.2.3