Files
Lesstime/src/Module/Reporting/Infrastructure/ApiPlatform/Resource/TasksByStatusResource.php
T
Matthieu b3b29fd753 feat(reporting) : add transverse Reporting module (DBAL read-only, back)
LST-59 (3.1) backend. New native reporting module that aggregates across
TimeTracking/ProjectManagement/Absence with ZERO direct inter-module imports —
coupled only to the physical SQL schema via read-only DBAL (AuditLog provider
pattern).

- 4 read-only reports (ApiResource + DBAL provider + readonly DTO,
  paginationEnabled false, security reporting.view): /api/reports/
  {time-per-project, time-per-user, tasks-by-status, absences-by-type}.
  All filters bound-param, dates validated YYYY-MM-DD (default = current month),
  int filters validated by regex (cs-fixer-stable).
- No Doctrine entity, no migration. ReportFilterTrait centralises validation.
  Absence status compared by literal 'approved' to avoid importing the enum.
- ReportingModule registered (id reporting, reporting.view/export perms);
  sidebar /reporting item gated by module + permission (ROLE_ADMIN section).

169 tests green (163 + 6), 4 routes exposed, cs-fixer clean.
2026-06-21 00:08:43 +02:00

33 lines
990 B
PHP

<?php
declare(strict_types=1);
namespace App\Module\Reporting\Infrastructure\ApiPlatform\Resource;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\GetCollection;
use App\Module\Reporting\Application\DTO\TasksByStatusOutput;
use App\Module\Reporting\Infrastructure\ApiPlatform\State\TasksByStatusProvider;
/**
* Rapport en lecture seule : nombre de taches non archivees par statut.
*
* Filtre query-param : ?projectId=
*
* Aucune entite Doctrine sous-jacente : le provider lit via DBAL et retourne
* directement une liste de TasksByStatusOutput. Pagination desactivee.
*/
#[ApiResource(
shortName: 'ReportTasksByStatus',
operations: [
new GetCollection(
uriTemplate: '/reports/tasks-by-status',
paginationEnabled: false,
security: "is_granted('reporting.view')",
provider: TasksByStatusProvider::class,
),
],
output: TasksByStatusOutput::class,
)]
final class TasksByStatusResource {}