Files
Starseed/src/Shared/Domain/Exception/FileUploadException.php
T
matthieu 1e783bd753
Auto Tag Develop / tag (push) Successful in 8s
feat(shared) : infra upload générique (ERP-154) (#108)
Infra d'upload de fichiers générique et réutilisable dans `Shared` (spec M4 § 2.7). Ne touche pas au module Transport.

## Livré
- **Table `uploaded_document`** (migration racine `DoctrineMigrations`) : fichier téléversé immuable (PDF / images) — `original_filename`, `stored_path`, `mime_type`, `size_bytes`, `checksum` (sha256), `created_at`, `created_by`. COMMENT ON COLUMN sur toutes les colonnes + bloc dans `ColumnCommentsCatalog`.
- **Service `Shared\Infrastructure\Upload\FileUploader`** : validation MIME server-side via `getMimeType()` (jamais `getClientMimeType()`), whitelist explicite (PDF + images), bornage taille (10 Mo), checksum sha256, écriture disque `var/uploads/{yyyy}/{mm}/`.
- **Endpoint `POST /api/uploaded_documents`** (multipart, `deserialize:false`) + `UploadedDocumentProcessor` -> renvoie l'IRI ; MIME hors whitelist -> 422.
- Wiring : mapping Doctrine `Shared` + path API Platform `Shared`.

## Tests
- `FileUploaderTest` (unitaire) + `UploadedDocumentApiTest` (fonctionnel : 201/IRI/checksum, 422 MIME interdit, 422 sans fichier, 401 anonyme).

`make test` vert (701 tests), `php-cs-fixer` propre.

## Hors scope
Pas d'antivirus / S3 / purge (§ 9). Pas de `carrier.discharge_document_id` (ticket consommateur M4).

Ticket ERP-154.

---------

Co-authored-by: Matthieu <contact@malio.fr>
Reviewed-on: #108
2026-06-15 15:25:32 +00:00

17 lines
431 B
PHP

<?php
declare(strict_types=1);
namespace App\Shared\Domain\Exception;
use RuntimeException;
/**
* Exception de base des erreurs de televersement (FileUploader).
*
* Decouplee de HTTP : le service Shared\Infrastructure\Upload\FileUploader leve
* une de ces exceptions metier, et c'est la couche API (UploadedDocumentProcessor)
* qui la traduit en reponse HTTP 422.
*/
class FileUploadException extends RuntimeException {}