This commit is contained in:
xds
2026-02-15 12:42:15 +03:00
parent 97483b7030
commit 5e7dc19bf3
9 changed files with 162 additions and 21 deletions

View File

@@ -37,3 +37,17 @@ class IdeaRepo:
{"$set": {"is_deleted": True}}
)
return res.modified_count > 0
async def update_idea(self, idea: Idea) -> bool:
if not idea.id or not ObjectId.is_valid(idea.id):
return False
idea_dict = idea.model_dump()
if "id" in idea_dict:
del idea_dict["id"]
res = await self.collection.update_one(
{"_id": ObjectId(idea.id)},
{"$set": idea_dict}
)
return res.modified_count > 0