Second Brain

Arquitetura — D2U.NET

D2U.NET · Implementacao · Flows · Testes · Seguranca

Padrão

Clean Architecture + Hexagonal (monólito modular)

Pergunta Resposta
UI Razor Pages (~85 PageModels) + Minimal APIs
Paridade legado? 100% código — 164 Struts mappings, ~47 DWR, 22 flows

Camadas

D2U.Domain          → entidades, enums, FSM rules
D2U.Application     → services, API abstractions, validators
D2U.Persistence     → EF Core + Npgsql PostgreSQL 16, schema `d2u`
D2U.Infrastructure  → Auth, payments, **JobDashboardService** (inbox por role), API, workers, FTP
D2U.Web             → Razor Pages + MapApiEndpoints + legacy aliases
D2U.Workers         → MailReader, FTP, SpeechLive, Lexacom, egress
D2U.Tools.Etl       → MySQL → PostgreSQL cutover CLI

Request flow

HTTP → SecurityHeaders → Auth → CompanyResolution → Authorization
     → Razor Page  (MedTrans / SuperUser / Outside)
     → Minimal API (/api/*, /webhooks/*, /xmlrpc, /SPS*)
     → Application Service → EF → **PostgreSQL** (schema `d2u`)

UI — substituição JSP

Legado .NET
navigator.jsp Partials/_MedTransNavigator.cshtml
header.jsp + footer.jsp _MedTransLayout.cshtml
indexv2.jsp _LoginLayout.cshtml + Login.cshtml
superuser/includes/* _SuperUserLayout.cshtml
outside-report.jsp _OutsideLayout.cshtml

CSS: wwwroot/css/dictate2us/styles.css (copiado do legado)

Entry points externos

Canal .NET Flows
Struts *.do Razor Pages + LegacyDoRedirectMiddleware 01–18
DWR /api/dwr/* (EF) 07, 14, 15
Mobile servlets /api/mobile/* 16, 03
XML-RPC /xmlrpc (wire protocol) 17
SpeechLive SPS /SPS*, aliases legados 21
Stripe/RealEx/PayPal /webhooks/* 05, 20
Outside /Outside/* 22
Vendor FTP Workers + FluentFTP egress 19
Data folder /data/*

Detalhe por flow: Flows

Testes

388 pass · 0 skip · 0 failTestes · Casos-de-Teste

Multi-tenant

  • ICurrentCompanyContext + EF filter CompanyId (fix cache Onda 3)
  • Temas: Company.ThemeFolder → CSS legado
  • Policy: Company.PolicyJson → permissions, IP allowlist, single session

Spec

  • Docs_New/architecture/
  • Docs_New/implementation/onda9-paridade-completa.md