diff --git a/app.py b/app.py index ade41df..cdd5db2 100644 --- a/app.py +++ b/app.py @@ -84,6 +84,22 @@ def editCard(username, deckTitle, cardIndex): # would redirect to template for Cards return "edited card" +@app.route("////delete") +def deleteCard(username, deckTitle, cardIndex): + # would need to first find user in db, but not set up yet + deck = db.decks.find_one({"title": deckTitle}) + deck["cards"].pop(int(cardIndex)) + db.decks.update_one({"title": deckTitle}, {"$set": deck}) + # would redirect to template for Cards + return "deleted card" + +@app.route("///delete") +def deleteDeck(username, deckTitle): + # would need to first find user in db, but not set up yet + db.decks.delete_one({"title": deckTitle}) + # would redirect to template for Cards + return "deleted deck" + # run the app if __name__ == "__main__": FLASK_PORT = os.getenv("FLASK_PORT", "5000")