Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
8 / 8 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| ListPendingUploadsAction | |
100.00% |
8 / 8 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| __invoke | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace App\Action\Document\Submission\Admin; |
| 6 | |
| 7 | use App\Domain\Document\Submission\Service\InvestorDocumentService; |
| 8 | use App\Renderer\JsonRenderer; |
| 9 | use Psr\Http\Message\ResponseInterface; |
| 10 | use Psr\Http\Message\ServerRequestInterface; |
| 11 | |
| 12 | /** |
| 13 | * Pending-review queue across all investors. Powers the admin review |
| 14 | * dashboard. |
| 15 | */ |
| 16 | final readonly class ListPendingUploadsAction |
| 17 | { |
| 18 | public function __construct( |
| 19 | private InvestorDocumentService $service, |
| 20 | private JsonRenderer $renderer, |
| 21 | ) {} |
| 22 | |
| 23 | public function __invoke(ServerRequestInterface $request, ResponseInterface $response): ResponseInterface |
| 24 | { |
| 25 | $documents = $this->service->listPendingForAdmin(); |
| 26 | |
| 27 | return $this->renderer->json($response, [ |
| 28 | 'success' => true, |
| 29 | 'data' => [ |
| 30 | 'documents' => array_map(static fn($d) => $d->toArray(), $documents), |
| 31 | ], |
| 32 | ]); |
| 33 | } |
| 34 | } |