diff --git a/main.ipynb b/main.ipynb index f67d044..5e77642 100644 --- a/main.ipynb +++ b/main.ipynb @@ -3277,6 +3277,12 @@ " new_doc = {**existing, **update_data, \"notify\": notify.upserted_id}\n", "\n", " result = await delivery_collection.insert_one(new_doc)\n", + " else:\n", + " doc = await posts_collection.update_one({'$or': fin}, {'$set': {\"status\": \"В каталоге\"}})\n", + " await delivery_collection.delete_one(\n", + " {\"post_id\": post_id, \"status\": \"Продано\"}\n", + " )\n", + "\n", " return {'ok': True}" ], "display_name": ".venv" diff --git a/main.py b/main.py index 697cc95..ac75bad 100644 --- a/main.py +++ b/main.py @@ -2443,6 +2443,12 @@ async def sale_painting( new_doc = {**existing, **update_data, "notify": notify.upserted_id} result = await delivery_collection.insert_one(new_doc) + else: + doc = await posts_collection.update_one({'$or': fin}, {'$set': {"status": "В каталоге"}}) + await delivery_collection.delete_one( + {"post_id": post_id, "status": "Продано"} + ) + return {'ok': True} @app.put("/api/post/{post_id}", response_model=dict)