Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
162 commits
Select commit Hold shift + click to select a range
68b79ef
docs: remove all staging environment references (project has only dev…
Dec 14, 2025
0ba72ee
feat(health-checks): add business-specific health checks and UI dashb…
Dec 14, 2025
4027f8a
docs(roadmap): update Sprint 4 progress - health checks completed
Dec 14, 2025
a6f2db8
feat(health-checks): add business-specific health checks and UI dashb…
Dec 15, 2025
db02a20
docs(roadmap): update Sprint 4 progress - health checks completed
Dec 15, 2025
531feb0
feat(data-seeding): add ServiceCatalogs seed script
Dec 15, 2025
bb41691
refactor(seeding): separate essential domain data from test data
Dec 15, 2025
8555c4f
refactor(structure): reorganize seeds and automation into infrastructure
Dec 15, 2025
2b390cc
docs(roadmap): update Sprint 4 with final structure changes
Dec 15, 2025
7ef4523
docs(sprint4): add comprehensive TODO document for pending tasks
Dec 15, 2025
f88b0e5
chore: remove TODO document - implement instead of documenting
Dec 15, 2025
aece8eb
feat(health-checks): complete external services health checks and met…
Dec 15, 2025
2dd6cf5
docs(roadmap): mark Sprint 4 as COMPLETE - all health checks implemented
Dec 15, 2025
91bd063
Merge branch 'master' into feature/health-checks-seeding
Dec 15, 2025
fd9b7fa
refactor: address CodeRabbit review comments
Dec 15, 2025
0d8bda6
fix: correct NuGet package IDs and configuration keys
Dec 15, 2025
f6bac82
fix: revert to correct NuGet package ID AspNetCore.HealthChecks.Npgsql
Dec 15, 2025
9fadf0b
refactor: optimize health check package dependencies
Dec 15, 2025
6b733cf
fix: update IBGE API tests for /estados endpoint
Dec 15, 2025
6760abd
fix: regenerate package lock files for consistency
Dec 15, 2025
de99cc4
test: add missing HTTP mock for IBGE API in health check test
Dec 15, 2025
0d58baa
test: improve health check test assertions
Dec 15, 2025
54f094b
ci: add database environment variables for integration tests
Dec 15, 2025
32f47a8
refactor: apply DRY principle and fix mock isolation
Dec 15, 2025
3eea4ef
refactor: separate test execution in aspire-ci-cd workflow and improv…
Dec 15, 2025
83e5bbe
refactor: remove dynamic and reflection from health check tests
Dec 15, 2025
28a5b03
ci: fix CI issues - install Aspire workload and configure health chec…
Dec 15, 2025
6a1f662
fix: apply CodeRabbit suggestions and improve Aspire workload install…
Dec 15, 2025
1daa0b4
fix: external services health check should never return Unhealthy
Dec 15, 2025
a917b71
perf(ci): conditionally install Aspire workload only for integration …
Dec 15, 2025
a4e7442
fix: improve Aspire workload installation and health check endpoint f…
Dec 15, 2025
76b74fb
fix(tests): change HealthCheck_ShouldIncludeProvidersDatabase to vali…
Dec 15, 2025
adeaca1
ci: add detailed DCP binary verification with explicit path checks
Dec 15, 2025
ec371ad
fix(ci): copy improved Aspire workload installation to pr-validation …
Dec 15, 2025
c023061
fix: correct FluentAssertions syntax and nullability warning
Dec 15, 2025
424f6c8
refactor: remove trailing whitespace and improve health check test ro…
Dec 15, 2025
f093a44
fix(ci): remove deprecated Aspire workload installation - use NuGet p…
Dec 15, 2025
12d2573
fix(ci): correct YAML indentation and improve code quality
Dec 15, 2025
5a4e146
test: skip Aspire DCP tests and fix health check structure
Dec 15, 2025
9fd970c
refactor: apply CodeRabbit review suggestions
Dec 15, 2025
0659413
fix(e2e): disable external services health checks in E2E tests
Dec 15, 2025
31d116e
refactor: apply final CodeRabbit improvements
Dec 15, 2025
3622581
fix(e2e): accept 503 as valid response for readiness check in E2E tests
Dec 15, 2025
8d27a7a
fix: dispose HttpResponseMessage to prevent connection leaks in healt…
Dec 15, 2025
faacbc9
fix: compilation error and apply final CodeRabbit improvements
Dec 15, 2025
ebd5010
fix(ci): pin ReportGenerator to v5.3.11 for .NET 8 compatibility
Dec 15, 2025
284a329
fix(ci): use latest ReportGenerator with .NET 10 verification
Dec 15, 2025
3adfe20
fix(ci): set DOTNET_ROOT and add job timeouts to prevent hangs
Dec 16, 2025
8052cac
feat: add configurable health endpoint paths and CI improvements
Dec 16, 2025
6ce4667
fix: resolve CS1744 compilation error and apply remaining CodeRabbit …
Dec 16, 2025
7c289ea
fix: address CodeRabbit review and fix ReportGenerator DOTNET_ROOT issue
Dec 16, 2025
2c26c7b
fix: resolve DOTNET_ROOT detection and strengthen validation
Dec 16, 2025
e87dd42
fix: update lychee-action to v2.8.2 to resolve download error
Dec 16, 2025
de96402
fix: correct lychee-action version to v2.8.0 and document fixture usage
Dec 16, 2025
05e6b7f
fix: use lychee-action@v2 major version tag
Dec 16, 2025
c76c416
fix: correct ReportGenerator validation check
Dec 16, 2025
afe68ef
chore: update Aspire packages and suppress CS9113 warning
Dec 16, 2025
987cfeb
chore: apply CodeRabbit review suggestions
Dec 16, 2025
02e0d2f
feat: add Hangfire health check with tests
Dec 16, 2025
0503eaa
feat: enable STRICT_COVERAGE enforcement
Dec 16, 2025
83d5d7d
Merge branch 'master' into feature/health-checks-seeding
Dec 16, 2025
2be1482
fix: critical CI fixes and package casing corrections
Dec 16, 2025
9b3da6c
fix: remove Skip from DataSeeding tests and implement TODOs
Dec 16, 2025
999e1d3
fix: use EXECUTE...USING for parameterized DO block and fail fast in CI
Dec 16, 2025
c3fbba0
fix: address CodeRabbit review feedback on DataSeeding tests
Dec 16, 2025
8605b7a
fix: improve CI detection to use truthy value whitelist
Dec 16, 2025
dea2f28
fix: remove AspireIntegrationFixture dependency from DataSeeding tests
Dec 16, 2025
c15f7ec
fix: remove fail-fast CI logic and hardcode last schema interpolation
Dec 16, 2025
c12967d
fix: use NpgsqlConnectionStringBuilder to properly handle special cha…
Dec 16, 2025
a190dca
refactor(aspire): reorganize AppHost/ServiceDefaults structure and fi…
Dec 16, 2025
85abe72
security: remove hardcoded credentials and extract shared test helper
Dec 16, 2025
142221c
fix: enforce credential validation and snake_case naming consistency
Dec 16, 2025
629b660
fix: correct TestConnectionHelper method calls
Dec 16, 2025
be44c63
refactor(ApiService): reorganizar estrutura e melhorar organização de…
Dec 16, 2025
311d783
refactor: consolidar HostedServices e remover código de teste da prod…
Dec 16, 2025
db08289
refactor: implementar melhorias de code review
Dec 16, 2025
4d2c937
fix: corrigir teste de rate limiting para mensagem em português
Dec 16, 2025
58b45a4
fix: padronizar idiomas - logs em inglês, comentários em português
Dec 16, 2025
f5a4189
fix: corrigir compression providers e configuração Keycloak
Dec 16, 2025
f327c31
fix: atualizar teste GeographicRestrictionMiddleware para mensagem em…
Dec 16, 2025
5dfc46b
fix: corrigir problemas de integração de testes
Dec 16, 2025
3c644a6
fix: corrigir todos os problemas dos testes
Dec 16, 2025
630e066
fix: apply code review corrections and migrate integration tests to T…
Dec 17, 2025
805ed5d
refactor: improve HangfireHealthCheck verification and test quality
Dec 17, 2025
465104f
perf: optimize RateLimitingMiddleware and improve monitoring
Dec 17, 2025
6f62bc6
fix(ci): remove broken ReportGenerator version check
Dec 17, 2025
38efede
refactor(documents): reorganize module structure and improve code qua…
Dec 17, 2025
d671112
feat(Documents): Implement configurable MinimumConfidence and integra…
Dec 17, 2025
490777c
feat(Documents): Add migration control and handler documentation
Dec 17, 2025
ce7d4e9
refactor(Documents): Language standardization and IsTransientExceptio…
Dec 17, 2025
f28d7dd
refactor(Documents): Apply code review improvements
Dec 17, 2025
9a9b533
refactor(Documents): Apply additional code review improvements
Dec 17, 2025
ebdfd7d
refactor: Apply security and quality improvements from code review
Dec 17, 2025
253cf4b
refactor: Translate all Portuguese log messages to English
Dec 17, 2025
b1d40f7
refactor: Complete log message translation for remaining modules
Dec 17, 2025
f01b4da
refactor: Complete English log translation and code review improvements
Dec 17, 2025
4d127b6
refactor(locations): Implement comprehensive architectural improvements
Dec 17, 2025
1beed9e
fix: corrigir feedback do code review e traduzir comentários
Dec 17, 2025
32462c0
fix(ci): usar find case-insensitive para localizar pacote Aspire DCP
Dec 17, 2025
fcf365e
refactor(locations): criar camada API separada para consistência
Dec 17, 2025
f9ef646
fix: implementar correções completas do code review
Dec 17, 2025
17c25e4
fix(ci): usar build ao invés de restore para baixar pacotes Aspire DCP
Dec 17, 2025
2f0ef8c
fix(ci): forçar download explícito do pacote Aspire DCP via projeto t…
Dec 17, 2025
9f32366
fix(ci): remover trailing whitespace do workflow YAML
Dec 17, 2025
b596573
fix: padronizar mensagens de API para inglês e melhorar YAML lint
Dec 17, 2025
3371fbb
fix: atualizar assertions de testes para mensagens em inglês
Dec 17, 2025
cdbd77c
fix: reverter mensagens de API para português (user-facing)
Dec 17, 2025
b807b07
fix: corrigir seeding de allowed cities em testes de integracao
Dec 17, 2025
b70ce6b
refactor: padronizar estrutura do modulo Locations com outros modulos
Dec 17, 2025
27a1b86
docs: traduzir comentarios em ingles para portugues em Providers Valu…
Dec 17, 2025
bd82d17
refactor: mover Migrations para dentro de Persistence no modulo Provi…
Dec 17, 2025
855e31e
docs: remover CONFIGURATION.md redundante do modulo Providers
Dec 17, 2025
dc6d0d1
fix: corrigir testes de GeographicRestriction falhando em CI
Dec 17, 2025
5d845f7
refactor: reorganizar testes do modulo Providers
Dec 18, 2025
84858b5
refactor: eliminar duplicacoes e organizar testes de Queries vs Query…
Dec 18, 2025
8203938
fix: corrigir testes e endpoints conforme code review
Dec 18, 2025
5877834
refactor: implementar melhorias sugeridas no code review
Dec 18, 2025
ae451d1
fix: corrigir testes com mensagens de excecao em portugues
Dec 18, 2025
9a065f1
refactor: aplicar sugestoes do code review
Dec 18, 2025
af45c7c
fix: corrigir rotas e tratamento de excecoes do modulo Locations
Dec 18, 2025
3c615e8
refactor: aplicar melhorias de code review e corrigir mensagens de ex…
Dec 18, 2025
a840a8a
fix: corrigir configuracao da URL base do IBGE API no WireMock
Dec 18, 2025
40cce91
fix: adicionar diagnostico para ReportGenerator e escapar wildcards LIKE
Dec 18, 2025
5ae7e48
fix: usar GitHub Action oficial do ReportGenerator ao invés de instal…
Dec 18, 2025
e050f99
fix: migrar ci-cd.yml para GitHub Action oficial do ReportGenerator
Dec 18, 2025
fc76126
refactor: remover configuração obsoleta do DOTNET_ROOT
Dec 18, 2025
c0ab7ae
fix: corrigir issues apontados pelo code review
Dec 18, 2025
70a7a20
fix: configurar DOTNET_ROOT para ReportGenerator encontrar runtime .N…
Dec 18, 2025
ea129ac
fix: aplicar correções finais do code review
Dec 18, 2025
2d0ee0e
fix: validate-coverage deve usar relatório agregado do ReportGenerator
Dec 18, 2025
048b8a3
test: add GetCacheTags test for GetProvidersByIdsQuery
Dec 18, 2025
db96d4c
style: translate inline comment to Portuguese in GetProvidersByIdsQue…
Dec 18, 2025
f7ddc8b
test: add IsExpiredAt tests for Qualification value object
Dec 18, 2025
b55c379
test: add business logic tests and remove redundant tests
Dec 18, 2025
fd00f4a
refactor: improve test quality and add business logic tests
Dec 18, 2025
1bdd79c
test: add comprehensive business logic tests across modules
Dec 18, 2025
d01267e
refactor: improve test quality based on code review
Dec 18, 2025
16a5d8e
test: add tests for AddService and RemoveService command handlers
Dec 18, 2025
56156e7
refactor: finalize SearchProviders cleanup - translate comments and r…
Dec 18, 2025
23cac1c
feat: implement provider validation in DeleteServiceCommandHandler
Dec 18, 2025
9bc7b18
refactor: translate ServiceCatalogs Application comments to Portuguese
Dec 18, 2025
1feae97
docs: add comprehensive WithDescription to all ServiceCatalogs API en…
Dec 18, 2025
cd943fe
refactor: move Migrations folder inside Persistence
Dec 18, 2025
ee7513d
refactor: translate Infrastructure comments to Portuguese
Dec 18, 2025
e36f43c
fix: correct test IDs and translate error messages to Portuguese
Dec 18, 2025
d0f17ce
refactor: consolidate ServiceCatalogs integration tests into single file
Dec 18, 2025
f770cce
test: add ServiceCatalogsMappingExtensions tests and rename class
Dec 18, 2025
1686624
refactor(ServiceCatalogs): rename DtoMappingExtensions to ServiceCata…
Dec 18, 2025
7397c52
fix(Providers): translate user-facing error messages to Portuguese
Dec 18, 2025
8487805
refactor(Users): improve code organization and translations
Dec 18, 2025
c5c89e5
refactor(Users): remove unnecessary tests and code
Dec 18, 2025
7a50144
refactor(Users): resolve CA2000 warnings via .editorconfig
Dec 18, 2025
9c6d7d7
refactor(Users): resolve CA2000 pragmas via .editorconfig and transla…
Dec 18, 2025
6bd248b
chore: Remove orphaned .bru files and fix test assertions
Dec 18, 2025
0875c17
refactor(Authorization): Reorganize structure and improve organizatio…
Dec 18, 2025
ab58d5e
refactor(Authorization): Organize Authorization structure and fix com…
Dec 19, 2025
4815628
refactor(Shared): Massive cleanup and reorganization
Dec 19, 2025
16f0982
refactor(auth): migrate from Permission wrapper to EPermission enum
Dec 19, 2025
a861903
docs: add BusinessMetrics middleware alignment to technical debt and …
Dec 19, 2025
ca2b73a
docs: translate DapperConnection English comments to Portuguese
Dec 19, 2025
941f1fa
refactor: apply code review feedback and fix architecture test
Dec 19, 2025
413232c
docs: update health checks strategy - use Aspire native dashboard
Dec 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ nuget list EFCore.NamingConventions -PreRelease
1. Atualizar pacote via Dependabot PR
2. Executar suite completa de testes
3. Validar migrations existentes
4. Testar em staging antes de production
4. Testar localmente antes de production

## 📝 Notas Adicionais

Expand Down
2 changes: 1 addition & 1 deletion .github/issue-template/npgsql-10-stable-monitoring.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Quando Npgsql 10.0.0 stable for lançado:
- [ ] Executar: `dotnet build`
- [ ] Executar: `dotnet test`
- [ ] Executar: `dotnet test --filter "Category=HangfireIntegration"`
- [ ] Validar em staging
- [ ] Validar localmente
- [ ] Atualizar documentação: remover TODOs sobre Npgsql
- [ ] Fechar Issue #42

Expand Down
6 changes: 6 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@
<PackageVersion Include="Rebus.AzureServiceBus" Version="10.5.1" />
<PackageVersion Include="Rebus.RabbitMq" Version="10.1.0" />
<PackageVersion Include="Rebus.ServiceProvider" Version="10.7.0" />
<!-- Health Checks -->
<PackageVersion Include="AspNetCore.HealthChecks.UI" Version="8.0.2" />
<PackageVersion Include="AspNetCore.HealthChecks.UI.Client" Version="8.0.2" />
<PackageVersion Include="AspNetCore.HealthChecks.UI.InMemory.Storage" Version="8.0.2" />
<PackageVersion Include="AspNetCore.HealthChecks.Npgsql" Version="9.0.0" />
<PackageVersion Include="AspNetCore.HealthChecks.Redis" Version="8.0.1" />
<!-- Background Jobs -->
<PackageVersion Include="Hangfire.Core" Version="1.8.22" />
<PackageVersion Include="Hangfire.AspNetCore" Version="1.8.22" />
Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Uma plataforma abrangente de serviços construída com .NET Aspire, projetada para conectar prestadores de serviços com clientes usando arquitetura monólito modular.

<!-- Last updated: October 2, 2025 - Workflow syntax fixes applied -->
<!-- Last updated: December 14, 2025 - Sprint 4 Health Checks + Data Seeding -->

## 🎯 Visão Geral

Expand Down Expand Up @@ -67,7 +67,6 @@ O projeto foi organizado para facilitar navegação e manutenção:
```
📦 MeAjudaAi/
├── 📁 api/ # Especificações de API (OpenAPI)
├── 📁 automation/ # Scripts de automação CI/CD
├── 📁 build/ # Scripts de build e Makefile
├── 📁 config/ # Configurações de ferramentas
│ ├── .editorconfig # Estilo de código
Expand All @@ -83,12 +82,15 @@ O projeto foi organizado para facilitar navegação e manutenção:
│ ├── modules/ # Documentação por módulo
│ └── testing/ # Guias de testes
├── 📁 infrastructure/ # IaC e configurações de infraestrutura
│ ├── automation/ # Scripts de setup CI/CD
│ ├── compose/ # Docker Compose configs
│ ├── database/ # Database init scripts + seeds
│ └── keycloak/ # Keycloak configuration
├── 📁 scripts/ # Scripts de desenvolvimento
├── 📁 src/ # Código fonte da aplicação
├── 📁 tests/ # Testes automatizados
└── 📁 tools/ # Ferramentas de desenvolvimento
├── MigrationTool/ # CLI para migrações de banco
└── api-collections/ # Gerador de coleções Postman
└── api-collections/ # Gerador de coleções Bruno/Postman
```

### Diretórios Principais
Expand All @@ -98,11 +100,10 @@ O projeto foi organizado para facilitar navegação e manutenção:
| `src/` | Código fonte da aplicação | Módulos, APIs, domínios |
| `tests/` | Testes unitários e integração | xUnit v3, testes por módulo |
| `docs/` | Documentação técnica | Arquitetura, guias, ADRs |
| `infrastructure/` | Infraestrutura como código | Bicep, Docker, Kubernetes |
| `infrastructure/` | Infraestrutura como código | Bicep, Docker, database, CI/CD automation |
| `scripts/` | Scripts de desenvolvimento | Exportar API, testes, deploy |
| `build/` | Build e automação | Makefile, scripts de CI |
| `config/` | Configurações de ferramentas | Linting, segurança, cobertura |
| `automation/` | Setup de CI/CD | Scripts de configuração |

## 🚀 Início Rápido

Expand Down
2 changes: 1 addition & 1 deletion automation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Configures basic continuous integration:
### Full CI/CD Setup (`setup-cicd.ps1`)
Configures complete continuous integration and deployment:
- Everything from CI-only setup
- Automated deployment to staging/production
- Automated deployment to production
- Infrastructure provisioning
- Release management workflows

Expand Down
4 changes: 2 additions & 2 deletions docs/api-automation.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ cd tools/api-collections
- ✅ Aguarda API ficar pronta
- ✅ Gera `api-spec.json`
- ✅ Gera Postman Collections
- ✅ Cria Environments (dev/staging/prod)
- ✅ Cria Environments (dev/prod)
- ✅ Para a API

### Opção 2: Node.js apenas (só spec + collections)
Expand All @@ -158,7 +158,7 @@ node generate-postman-collections.js
**Vantagens:**
- ✅ Gera api-spec.json
- ✅ Gera Postman Collections
- ✅ Cria environments (dev/staging/prod)
- ✅ Cria environments (dev/prod)
- ✅ Testes automáticos incluídos

## 🔧 Configuração Inicial
Expand Down
4 changes: 2 additions & 2 deletions docs/api-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ A API MeAjudaAi segue os padrões REST e está documentada usando OpenAPI 3.0. T

- **Arquivo versionado**: `api/api-spec.json` (na raiz do repositório)
- **Swagger UI (Desenvolvimento)**: `http://localhost:5001/swagger`
- **Swagger UI (Staging)**: `https://meajudaai-staging.azurewebsites.net/swagger`

- **Download runtime**: `/swagger/v1/swagger.json`

## Endpoints Principais
Expand Down Expand Up @@ -127,7 +127,7 @@ X-Correlation-ID: <uuid> # Opcional mas recomendado para rastreamento
## Rate Limiting

- **Desenvolvimento**: Sem limite
- **Staging**: 100 req/min por IP

- **Production**: 60 req/min por usuário autenticado

Headers de resposta:
Expand Down
6 changes: 3 additions & 3 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -2153,7 +2153,7 @@ npm run validate
src/Shared/API.Collections/Generated/
├── MeAjudaAi-API-Collection.json # Collection principal
├── MeAjudaAi-development-Environment.json # Ambiente desenvolvimento
├── MeAjudaAi-staging-Environment.json # Ambiente staging

├── MeAjudaAi-production-Environment.json # Ambiente produção
└── README.md # Instruções de uso
```
Expand All @@ -2171,7 +2171,7 @@ options.OperationFilter<ApiVersionOperationFilter>();

- **🔒 Segurança JWT**: Configuração automática de Bearer tokens
- **📊 Schemas Reutilizáveis**: Componentes comuns (paginação, erros)
- **🌍 Multi-ambiente**: URLs para dev/staging/production
- **🌍 Multi-ambiente**: URLs para dev/production

### **Boas Práticas para Collections**

Expand Down Expand Up @@ -2211,7 +2211,7 @@ options.OperationFilter<ApiVersionOperationFilter>();
- ✅ **Funciona offline** (não precisa rodar aplicação)
- ✅ **Health checks incluídos** (/health, /health/ready, /health/live)
- ✅ **Schemas com exemplos** realistas
- ✅ **Múltiplos ambientes** (dev, staging, production)
- ✅ **Múltiplos ambientes** (dev, production)
- ⚠️ **Arquivo não versionado** (incluído no .gitignore)

#### **Importar em Clientes de API**
Expand Down
2 changes: 1 addition & 1 deletion docs/ci-cd.md
Original file line number Diff line number Diff line change
Expand Up @@ -1335,7 +1335,7 @@ POSTGRES_DB: ${{ secrets.POSTGRES_DB || 'meajudaai_test' }}
- [ ] **Matrix strategy**: Testar em Ubuntu + Windows
- [ ] **Reusable workflows**: Extrair jobs comuns
- [ ] **Composite actions**: Consolidar setup steps
- [ ] **GitHub Environments**: Separar dev/staging/prod
- [ ] **GitHub Environments**: Separar dev/prod

### Observabilidade
- [ ] **Badges no README**: Coverage, build status, dependencies
Expand Down
2 changes: 1 addition & 1 deletion docs/database.md
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ else
|---|---|---|
| **Desenvolvimento** | `EnableSchemaIsolation: false` | Usa usuário admin padrão |
| **Teste** | `EnableSchemaIsolation: false` | TestContainers com um único usuário |
| **Staging** | `EnableSchemaIsolation: true` | Usuário `users_role` dedicado |

| **Produção** | `EnableSchemaIsolation: true` | Máxima segurança para Users |

### 🛡️ Estrutura de Segurança
Expand Down
6 changes: 3 additions & 3 deletions docs/deployment-environments.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ Este documento descreve os diferentes ambientes de deploy disponíveis para a pl

**ANTES de fazer deploy em QUALQUER ambiente**, garanta que TODAS as validações críticas de compatibilidade passem.

Para procedimentos detalhados de validação de compatibilidade Hangfire + Npgsql 10.x, consulte a documentação de infraestrutura e execute testes em staging.
Para procedimentos detalhados de validação de compatibilidade Hangfire + Npgsql 10.x, consulte a documentação de infraestrutura e execute testes localmente.

**Checklist Rápido**:
- [ ] ⚠️ **CRÍTICO**: Smoke tests em staging com execução de jobs Hangfire (Npgsql 10.x NÃO VALIDADO)
- [ ] Verificação manual do dashboard Hangfire em staging
- [ ] ⚠️ **CRÍTICO**: Smoke tests locais com execução de jobs Hangfire (Npgsql 10.x NÃO VALIDADO)
- [ ] Verificação manual do dashboard Hangfire localmente
- [ ] Monitoramento de health check configurado (HealthChecks.Hangfire)
- [ ] Monitoramento configurado (alertas, dashboards)
- [ ] Procedimento de rollback testado
Expand Down
2 changes: 1 addition & 1 deletion docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ public class TestAuthenticationHandler : AuthenticationHandler<TestAuthenticatio
"SkipPermissionValidation": false,
"EnableCodeCoverage": true
},
"Staging": {
"Production": {
"UseInMemoryDatabase": false,
"UseTestAuthentication": false,
"SkipPermissionValidation": false
Expand Down
184 changes: 184 additions & 0 deletions docs/future-external-services.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
# External Services - Roadmap de Integração

Este documento lista serviços externos que serão integrados no futuro. Não implemente health checks para estes serviços agora - documente apenas quando a integração for desenvolvida.

## 📋 Status Atual

### ✅ Implementados (com Health Checks)

1. **Keycloak**
- **Propósito**: Autenticação e autorização (OAuth2/OIDC)
- **Health Check**: `ExternalServicesHealthCheck` - verifica `/realms/meajudaai`
- **Tags**: `ready`, `external`
- **Documentação**: [docs/authentication-and-authorization.md](authentication-and-authorization.md)

2. **IBGE API**
- **Propósito**: Validação de localização geográfica (estados, municípios)
- **Health Check**: `ExternalServicesHealthCheck` - verifica `/api/v1/localidades/estados/MG`
- **Tags**: `ready`, `external`
- **Endpoint**: `https://servicodados.ibge.gov.br/api/v1/localidades`
- **Módulo**: `Locations`
- **Cliente**: `IbgeClient.cs`

3. **Redis**
- **Propósito**: Cache distribuído
- **Health Check**: `AddRedis()` - health check nativo do AspNetCore.HealthChecks.Redis
- **Tags**: `ready`, `cache`
- **Documentação**: Configurado via Aspire

## 🔮 Serviços Futuros (NÃO Implementados)

### Sprint 5-6: OCR e Validação de Documentos

#### Azure Document Intelligence (OCR)
- **Propósito**: Extração de texto de documentos escaneados/fotos
- **Quando Implementar**: Quando módulo Documents estiver processando uploads de imagens
- **Health Check Futuro**:
- Endpoint: `POST /formrecognizer/documentModels/{modelId}:analyze`
- Verificar autenticação e quota disponível
- Tags: `ready`, `external`, `ocr`
- **Pacote**: `Azure.AI.DocumentIntelligence 1.0.0` (já instalado)
- **Configuração Necessária**:
- `Azure:DocumentIntelligence:Endpoint`
- `Azure:DocumentIntelligence:ApiKey`
- **Critérios para Health Check**:
- [ ] Módulo Documents aceita uploads de imagens
- [ ] OCR implementado em `DocumentVerificationJob.cs`
- [ ] Azure Document Intelligence configurado em ambiente

#### Azure Blob Storage
- **Propósito**: Armazenamento de documentos e fotos
- **Quando Implementar**: Quando uploads de documentos forem habilitados
- **Health Check Futuro**:
- Verificar conectividade com container
- Validar permissões de leitura/escrita
- Tags: `ready`, `external`, `storage`
- **Pacote**: `Azure.Storage.Blobs 12.26.0` (já instalado)
- **Configuração Necessária**:
- `Azure:Storage:ConnectionString`
- `Azure:Storage:ContainerName`

### Sprint 7-8: Validação de Prestadores

#### API Receita Federal (CNPJ/CPF)
- **Propósito**: Validação de documentos de prestadores (background checks)
- **Quando Implementar**: Quando verificação de prestadores for automatizada
- **Health Check Futuro**:
- Endpoint público ou API privada (a definir)
- Validar quota e rate limits
- Tags: `ready`, `external`, `validation`
- **Observações**:
- API pública da Receita pode ter rate limits agressivos
- Considerar alternativas: Serviços terceiros (ex: BrasilAPI, ReceitaWS)
- Implementar cache agressivo para consultas de CNPJ/CPF

#### BrasilAPI (Alternativa Receita Federal)
- **Propósito**: Validação de CNPJ, CEP, bancos
- **Quando Implementar**: Como alternativa à API da Receita
- **Health Check Futuro**:
- Endpoint: `https://brasilapi.com.br/api/status`
- Tags: `ready`, `external`, `validation`
- **Vantagens**:
- API pública gratuita
- Rate limits mais generosos
- Múltiplos endpoints úteis (CNPJ, CEP, bancos)

### Sprint 9-10: Pagamentos (Futuro Distante)

#### Gateway de Pagamento (Ex: PagSeguro, Mercado Pago)
- **Propósito**: Processar doações e pagamentos (se aplicável)
- **Quando Implementar**: Quando modelo de monetização for definido
- **Health Check Futuro**:
- Verificar autenticação com gateway
- Validar saldo e permissões
- Tags: `ready`, `external`, `payment`
- **Observações**:
- Aguardar decisão de modelo de negócio
- Pode nunca ser implementado se plataforma for 100% gratuita

### Sprint 11+: Notificações

#### SendGrid / AWS SES (Email)
- **Propósito**: Envio de emails transacionais (confirmação, notificações)
- **Quando Implementar**: Quando notificações por email forem necessárias
- **Health Check Futuro**:
- Verificar autenticação e quota
- Tags: `ready`, `external`, `email`

#### Twilio / AWS SNS (SMS)
- **Propósito**: Envio de SMS para notificações críticas
- **Quando Implementar**: Quando notificações por SMS forem necessárias
- **Health Check Futuro**:
- Verificar autenticação e saldo
- Tags: `ready`, `external`, `sms`

## 🎯 Decisões de Implementação

### Quando Adicionar Health Check para Novo Serviço Externo

✅ **ADICIONE Health Check se:**
- Serviço é crítico para funcionalidade principal da aplicação
- Falha do serviço impacta experiência do usuário
- Serviço é usado de forma síncrona (ex: validação em tempo real)
- Serviço está configurado em ambiente de produção

❌ **NÃO ADICIONE Health Check se:**
- Serviço é opcional ou experimental
- Serviço ainda não está configurado/implementado
- Serviço é usado apenas em jobs assíncronos (Hangfire já monitora)
- Falha do serviço não impacta disponibilidade da aplicação

### Template para Implementação Futura

Quando implementar health check para novo serviço:

```csharp
// Em ExternalServicesHealthCheck.cs

// Verificar [Nome do Serviço]
try
{
var serviceUrl = configuration["[ServiceConfig:Url]"];
if (!string.IsNullOrEmpty(serviceUrl))
{
var stopwatch = System.Diagnostics.Stopwatch.StartNew();
using var response = await httpClient.GetAsync($"{serviceUrl}/[health-endpoint]", cancellationToken);
stopwatch.Stop();

results["[service_name]"] = new
{
status = response.IsSuccessStatusCode ? "healthy" : "unhealthy",
response_time_ms = stopwatch.ElapsedMilliseconds,
endpoint = "[health-endpoint]"
};

if (!response.IsSuccessStatusCode)
allHealthy = false;
}
}
catch (Exception ex)
{
results["[service_name]"] = new { status = "unhealthy", error = ex.Message };
allHealthy = false;
}
```

### Checklist para Nova Integração

Antes de adicionar health check para novo serviço externo:

- [ ] Serviço está implementado e funcional no código
- [ ] Configuração do serviço existe em `appsettings.json`
- [ ] Cliente HTTP ou SDK está configurado no DI container
- [ ] Serviço está disponível em ambiente de desenvolvimento
- [ ] Endpoint de health check do serviço foi identificado
- [ ] Timeout apropriado está configurado (padrão: 5s)
- [ ] Testes unitários foram criados para o health check
- [ ] Documentação foi atualizada neste arquivo

## 📚 Referências

- [ASP.NET Core Health Checks](https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/health-checks)
- [AspNetCore.Diagnostics.HealthChecks](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks)
- [Health UI Dashboard](http://localhost:5193/health-ui) (Development)
- [Roadmap Geral](roadmap.md)
2 changes: 1 addition & 1 deletion docs/infrastructure.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ O arquivo `infrastructure/keycloak/realms/meajudaai-realm.json` contém:

#### Usuários de Teste (Desenvolvimento Local)

> ⚠️ **AVISO DE SEGURANÇA**: As credenciais abaixo são EXCLUSIVAMENTE para desenvolvimento local. NUNCA utilize essas credenciais em ambientes compartilhados, staging ou produção.
> ⚠️ **AVISO DE SEGURANÇA**: As credenciais abaixo são EXCLUSIVAMENTE para desenvolvimento local. NUNCA utilize essas credenciais em produção.

- **admin** / admin123 (admin, super-admin) - **DEV ONLY**
- **customer1** / customer123 (customer) - **DEV ONLY**
Expand Down
2 changes: 1 addition & 1 deletion docs/messaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public class EnvironmentBasedMessageBusFactory : IMessageBusFactory
}
else
{
// STAGING/OUTROS: NoOp por segurança
// OUTROS: NoOp por segurança
return _serviceProvider.GetRequiredService<NoOpMessageBus>();
}
}
Expand Down
Loading
Loading