Микросервисная архитектура платформы REKLA
Основные функции
Технологии
class BaseSQLRepo: def __init__(self, session: AsyncSession): self.session = session async def get(self, id: int) -> Optional[Model]: # Базовая реализация получения по ID pass async def create(self, **kwargs) -> Model: # Базовая реализация создания pass
class UnitOfWork: def __init__(self): self.users = UserRepository() self.channels = ChannelRepository() async def __aenter__(self): self.session = await create_session() return self async def commit(self): await self.session.commit() async def rollback(self): await self.session.rollback()
@dataclass class PublicationCreated: publication_id: int channel_id: int user_id: int scheduled_at: datetime # Обработчик события async def handle_publication_created(event: PublicationCreated): await marking_service.process_publication(event.publication_id)
Was this page helpful?