inspirations

This commit is contained in:
xds
2026-02-24 16:42:46 +03:00
parent bc9230a49b
commit ecc8d69039
16 changed files with 458 additions and 17 deletions

View File

@@ -7,8 +7,14 @@ class IdeaService:
def __init__(self, dao: DAO):
self.dao = dao
async def create_idea(self, name: str, description: Optional[str], project_id: Optional[str], user_id: str) -> Idea:
idea = Idea(name=name, description=description, project_id=project_id, created_by=user_id)
async def create_idea(self, name: str, description: Optional[str], project_id: Optional[str], user_id: str, inspiration_id: Optional[str] = None) -> Idea:
idea = Idea(
name=name,
description=description,
project_id=project_id,
created_by=user_id,
inspiration_id=inspiration_id
)
idea_id = await self.dao.ideas.create_idea(idea)
idea.id = idea_id
return idea
@@ -19,7 +25,7 @@ class IdeaService:
async def get_idea(self, idea_id: str) -> Optional[Idea]:
return await self.dao.ideas.get_idea(idea_id)
async def update_idea(self, idea_id: str, name: Optional[str] = None, description: Optional[str] = None) -> Optional[Idea]:
async def update_idea(self, idea_id: str, name: Optional[str] = None, description: Optional[str] = None, inspiration_id: Optional[str] = None) -> Optional[Idea]:
idea = await self.dao.ideas.get_idea(idea_id)
if not idea:
return None
@@ -28,6 +34,8 @@ class IdeaService:
idea.name = name
if description is not None:
idea.description = description
if inspiration_id is not None:
idea.inspiration_id = inspiration_id
idea.updated_at = datetime.now()
await self.dao.ideas.update_idea(idea)
@@ -72,4 +80,3 @@ class IdeaService:
return True
return False