Перевод на доменную архитектуру

This commit is contained in:
brusnitsyn
2026-04-26 23:37:50 +09:00
parent 75ca01ffd8
commit f107ebd167
70 changed files with 4656 additions and 2070 deletions

View File

@@ -0,0 +1,19 @@
# ADR 0001: Report Domain Strangler
## Status
Accepted
## Context
The first report flow in the medical reporting system has grown into a large Laravel service that mixes orchestration, replica reads, calculations, persistence, snapshots, and post-processing.
## Decision
We introduce `Domain/Reports`, `Application/Reports`, and `Infrastructure/Reports` alongside the legacy implementation. The first migration slice covers only the save path and auto-fill path. Read-side statistics remain on the legacy path.
The new save flow is orchestrated by `GenerateReportUseCase` and persists through `EloquentReportRepository`. Transitional adapters to `ReportService` and `SnapshotService` are allowed until formulas and data sources are moved into Domain-native calculators and sources.
Feature rollout is controlled by `config('reports.use_new_arch.report_types')`. Each new-path execution writes an audit record to `reports_audit` with comparison status and diff payload.
## Consequences
- Legacy behavior remains available as a fallback.
- New code can be unit-tested without framework imports in Domain/Application DTOs.
- Future reports can reuse the same orchestration, repository contract, and audit pipeline.