Repository navigation
refactor(messaging): unificar envio de e-mails via EmailConsumer e remover BackgroundTasks redundantes - #147
Merged
Conversation
…roundTasks redundantes
…mover BackgroundTasks redundantes - adicionado evento tipado EmailVerificationRequestedEvent e constante AuthEvents.EMAIL_VERIFICATION_REQUESTED - implementado processamento de e-mails de reset de senha e verificacao no EmailConsumer - removido BackgroundTasks das rotas de autenticacao e eliminadas funcoes _bg com sessoes manuais de banco - atualizada suite de testes para validar o fluxo 100% orientado a eventos (EDA) com pytest, ruff e mypy 100% green
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎯 Contexto e Motivação
Esta PR implementa a resolução da Issue #146, unificando 100% dos disparos de e-mail na arquitetura orientada a eventos (EDA) através do
EmailConsumer, eliminando o mecanismo legado e acoplado deBackgroundTasksdo FastAPI nas rotas de autenticação.🏗️ O Que Foi Modificado
Camada de Eventos (
app/messaging/events/):AuthEvents.EMAIL_VERIFICATION_REQUESTED = 'auth.email_verification_requested'.EmailVerificationRequestedEvent(DomainEvent).Schemas e Notificações (
app/schemas/notification.pyeapp/services/notification_service.py):EmailVerificationRequestedPayload.create_verification_requested_email.Consumidor Dedicado (
app/messaging/consumers/email_consumer.py):EmailConsumeragora consome centralmente os eventosAuthEvents.PASSWORD_RESET_REQUESTEDeAuthEvents.EMAIL_VERIFICATION_REQUESTED, delegando o envio paraemail_servicecom retentativas automáticas (backoff exponencial) e proteção de Dead-Letter Queue (DLQ) no Redis (events:dlq).Desacoplamento de Rotas e Serviços (
app/services/auth_service.pyeapp/api/routers/auth.py):BackgroundTasksdas rotasPOST /api/auth/password-reset/requestePOST /api/auth/verify-email/resend.request_password_reset_bgeresend_verification_email_bg, eliminando a abertura manual de sessões de banco em background (session_factory()).EventBus.Testes & Qualidade:
EmailConsumer.433 passed).ruffemypy100% limpos).Closes #146