Работа над журналом для ст. мед сестер
This commit is contained in:
@@ -3,11 +3,12 @@
|
||||
namespace App\Application\Reports;
|
||||
|
||||
use App\Application\Reports\DTO\GenerateReportResult;
|
||||
use App\Infrastructure\Reports\Services\AutoFillReportPayloadBuilder;
|
||||
use App\Infrastructure\Reports\Services\ReportSaveOrchestrator;
|
||||
use App\Models\Department;
|
||||
use App\Models\Report;
|
||||
use App\Models\User;
|
||||
use App\Services\DateRange;
|
||||
use App\Services\ReportService;
|
||||
|
||||
final readonly class ReportSavePathService
|
||||
{
|
||||
@@ -15,7 +16,8 @@ final readonly class ReportSavePathService
|
||||
private ReportFlowDecider $reportFlowDecider,
|
||||
private ReportInputFactory $reportInputFactory,
|
||||
private GenerateReportUseCase $generateReportUseCase,
|
||||
private ReportService $reportService,
|
||||
private ReportSaveOrchestrator $reportSaveOrchestrator,
|
||||
private AutoFillReportPayloadBuilder $autoFillReportPayloadBuilder,
|
||||
) {}
|
||||
|
||||
public function usesNewArchitecture(string $reportType = 'daily'): bool
|
||||
@@ -29,7 +31,7 @@ final readonly class ReportSavePathService
|
||||
public function saveManual(User $actor, array $validated, string $reportType = 'daily'): GenerateReportResult|Report
|
||||
{
|
||||
if (! $this->usesNewArchitecture($reportType)) {
|
||||
return $this->reportService->storeReport($validated, $actor, false);
|
||||
return $this->reportSaveOrchestrator->storeReport($validated, $actor, false);
|
||||
}
|
||||
|
||||
return $this->generateReportUseCase->handle(
|
||||
@@ -44,9 +46,9 @@ final readonly class ReportSavePathService
|
||||
string $reportType = 'daily',
|
||||
): GenerateReportResult|Report {
|
||||
if (! $this->usesNewArchitecture($reportType)) {
|
||||
$payload = $this->reportService->buildAutoFillReportPayload($scopedUser, $department, $dateRange);
|
||||
$payload = $this->autoFillReportPayloadBuilder->build($scopedUser, $department, $dateRange);
|
||||
|
||||
return $this->reportService->storeReport($payload, $scopedUser, true);
|
||||
return $this->reportSaveOrchestrator->storeReport($payload, $scopedUser, true);
|
||||
}
|
||||
|
||||
return $this->generateReportUseCase->handle(
|
||||
|
||||
Reference in New Issue
Block a user