fix(): add flush to uow.add to ensure db sync

This commit is contained in:
doas root
2025-11-12 00:10:58 +03:00
parent 08a2ae6456
commit 89dffcabbd
7 changed files with 57 additions and 6 deletions
@@ -4,7 +4,7 @@ from typing import Any, Protocol
class UnitOfWork(Protocol):
@abstractmethod
def add(self, *entities: Any) -> None:
async def add(self, *entities: Any) -> None:
raise NotImplementedError
@abstractmethod
@@ -43,7 +43,9 @@ class UserSignUpInteractor:
response = UserSignUpResponse(access_token=crypted_access_token)
self.unit_of_work.add(user, access_token)
for entity in (user, access_token): # preserve creation order
await self.unit_of_work.add(entity)
await self.unit_of_work.commit()
return response