Перевод на доменную архитектуру
This commit is contained in:
@@ -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),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user