feat(shared) : infra upload générique (ERP-154) #108

Merged
matthieu merged 6 commits from feat/erp-154-upload into develop 2026-06-15 15:25:32 +00:00
Owner

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.

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.
matthieu added 1 commit 2026-06-15 14:08:54 +00:00
feat(shared) : infra upload générique (ERP-154)
Pull Request — Quality gate / Backend (PHP CS + PHPUnit) (pull_request) Successful in 2m40s
Pull Request — Quality gate / Frontend (lint + Vitest + build) (pull_request) Successful in 1m22s
b989c33cc4
Pose une infra d'upload de fichiers générique et réutilisable dans Shared
(spec M4 § 2.7), sans toucher au module Transport.

- Table uploaded_document (migration racine DoctrineMigrations) : fichier
  téléversé immuable (PDF / images), checksum sha256, created_at/created_by.
- Service Shared\Infrastructure\Upload\FileUploader : validation MIME
  server-side via getMimeType (jamais getClientMimeType), whitelist explicite
  (PDF + images), bornage taille, checksum sha256, écriture var/uploads/{yyyy}/{mm}/.
- Endpoint POST /api/uploaded_documents (multipart, deserialize:false) +
  UploadedDocumentProcessor -> renvoie l'IRI ; MIME hors whitelist -> 422.
- COMMENT ON COLUMN sur toutes les colonnes + bloc dans ColumnCommentsCatalog.
- Mapping Doctrine Shared + path API Platform Shared.
- Tests : FileUploader (unit) + endpoint (fonctionnel, 422 / IRI / checksum).
matthieu added the backdbM4-Transporteurtype/feat labels 2026-06-15 14:09:19 +00:00
matthieu added 1 commit 2026-06-15 14:56:21 +00:00
fix(shared) : durcissement infra upload (ERP-154)
Pull Request — Quality gate / Backend (PHP CS + PHPUnit) (pull_request) Failing after 50s
Pull Request — Quality gate / Frontend (lint + Vitest + build) (pull_request) Successful in 1m25s
a579ee6378
- supprime le fichier orphelin sur disque si la persistance Doctrine echoue apres l ecriture (FileUploader::remove + compensation dans le processor)
- gere hash_file() renvoyant false (fichier illisible) -> FileUploadException au lieu d un TypeError opaque
- documente le choix de securite du GET (infra generique, cloisonnement delegue au consommateur)
matthieu added 1 commit 2026-06-15 15:05:44 +00:00
Merge branch 'develop' into feat/erp-154-upload
Pull Request — Quality gate / Backend (PHP CS + PHPUnit) (pull_request) Failing after 52s
Pull Request — Quality gate / Frontend (lint + Vitest + build) (pull_request) Has been cancelled
08d6fdb169
matthieu added 1 commit 2026-06-15 15:06:38 +00:00
style(shared) : importe Throwable dans UploadedDocumentProcessor
Pull Request — Quality gate / Backend (PHP CS + PHPUnit) (pull_request) Successful in 2m37s
Pull Request — Quality gate / Frontend (lint + Vitest + build) (pull_request) Successful in 1m26s
f3707ca287
Conforme a la regle php-cs-fixer global_namespace_import (gate CI Backend).
matthieu added 1 commit 2026-06-15 15:11:02 +00:00
Merge branch 'develop' into feat/erp-154-upload
Pull Request — Quality gate / Backend (PHP CS + PHPUnit) (pull_request) Successful in 2m33s
Pull Request — Quality gate / Frontend (lint + Vitest + build) (pull_request) Successful in 1m24s
797ea18fdf
matthieu added 1 commit 2026-06-15 15:25:29 +00:00
Merge branch 'develop' into feat/erp-154-upload
Pull Request — Quality gate / Backend (PHP CS + PHPUnit) (pull_request) Successful in 2m36s
Pull Request — Quality gate / Frontend (lint + Vitest + build) (pull_request) Successful in 1m23s
a0bd84b8bd
matthieu merged commit 1e783bd753 into develop 2026-06-15 15:25:32 +00:00
matthieu deleted branch feat/erp-154-upload 2026-06-15 15:25:33 +00:00
Sign in to join this conversation.