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

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

@@ -2,6 +2,16 @@
namespace App\Providers;
use App\Application\Reports\CompareLegacyAndNewReportUseCase;
use App\Application\Reports\GenerateReportUseCase;
use App\Application\Reports\ReportInputFactory;
use App\Domain\Reports\Contracts\AuditLogger;
use App\Domain\Reports\Contracts\PatientSource;
use App\Domain\Reports\Contracts\ReportRepository;
use App\Infrastructure\Reports\Adapters\LegacyReportServiceAdapter;
use App\Infrastructure\Reports\Logging\ReportsAuditLogger;
use App\Infrastructure\Reports\Repositories\EloquentReportRepository;
use App\Infrastructure\Reports\Sources\LegacyAutoFillPatientSource;
use App\Services\Cache\CacheInvalidator;
use App\Services\Cache\CacheKeyBuilder;
use Illuminate\Support\ServiceProvider;
@@ -18,6 +28,26 @@ class AppServiceProvider extends ServiceProvider
});
$this->app->singleton(CacheInvalidator::class);
$this->app->singleton(ReportRepository::class, EloquentReportRepository::class);
$this->app->singleton(AuditLogger::class, ReportsAuditLogger::class);
$this->app->singleton(PatientSource::class, LegacyAutoFillPatientSource::class);
$this->app->singleton(CompareLegacyAndNewReportUseCase::class, function ($app) {
return new CompareLegacyAndNewReportUseCase(
$app->make(ReportRepository::class),
$app->make(LegacyReportServiceAdapter::class),
);
});
$this->app->singleton(ReportInputFactory::class);
$this->app->singleton(GenerateReportUseCase::class, function ($app) {
return new GenerateReportUseCase(
reportRepository: $app->make(ReportRepository::class),
auditLogger: $app->make(AuditLogger::class),
comparator: $app->make(CompareLegacyAndNewReportUseCase::class),
patientSource: $app->make(PatientSource::class),
calculators: [],
compareBeforeCutover: (bool) config('reports.use_new_arch.compare_before_cutover', true),
);
});
}
/**