feat(child): auto create parent-child conversations

This commit is contained in:
ChengCan
2026-04-30 00:58:07 +08:00
parent d21ff85807
commit 74a4819f82
6 changed files with 221 additions and 8 deletions

View File

@@ -26,6 +26,7 @@ class ChildDAO(BaseDAO):
child_name: str,
child_gender: int = 2,
child_birthday: Optional[date] = None,
auto_commit: bool = True,
) -> int:
result = self.db.execute(
text(
@@ -38,7 +39,8 @@ class ChildDAO(BaseDAO):
)
child_id = inserted_primary_key(result)
self._create_relation(user_id, child_id)
self.commit()
if auto_commit:
self.commit()
return child_id
def get_by_id(self, child_id: int) -> Optional[Mapping]: