feat(T05): Dateiablage pro Fahrzeug + File UI with thumbnails and gallery

This commit is contained in:
2026-07-17 01:38:48 +02:00
parent 149ac04dc1
commit a38d340ddc
18 changed files with 2649 additions and 69 deletions
+31 -32
View File
@@ -1,38 +1,37 @@
# Current Status
**Phase**: 3 - Implementation
**Date**: 2026-07-17
## T05: Dateiablage pro Fahrzeug + File UI
## Completed
- T01: Auth + User Management + RBAC + Base Frontend + i18n ✅
- 50 backend tests passed, 16 frontend tests passed
- Next.js build successful, health endpoint 200
- Commit: d893048
- T02: Vehicle Management + mobile.de Push + Vehicle UI ✅ (committed, tests pending verification)
- Commit: 74b5e6a
- T04: Contact Management + USt-IdNr. Validation + Contact UI ✅ (committed, tests pending verification)
- Commit: 2cf433a
- i18n fix: 'use client' directive added to i18n.tsx
- Commit: b128ea6
- T03: OCR-Erfassung via OpenRouter Vision + OCR UI ✅
- 33 backend tests passed (85% coverage), 18 frontend tests passed
- Full backend suite: 229 tests passed
- Backend: OCRResult model, schemas, OpenRouter client, ocr_service, async task, router
- Frontend: OCRUpload (drag-and-drop), OCRResults (list), OCRDetail (side-by-side), OCR page
- OpenRouter Qwen2.5-VL integration with structured JSON output
- Confidence threshold: < 0.7 → manual_review, >= 0.7 → completed
- Async processing via FastAPI BackgroundTasks
**Status:** COMPLETED
## In Progress
- None
### Backend
- ✅ File model (app/models/file.py) - UUID PK, vehicle_id FK, all fields
- ✅ File schemas (app/schemas/file.py) - FileUploadResponse, FileResponse, FileListResponse, FileDeleteResponse
- ✅ File service (app/services/file_service.py) - upload, get, list, delete, validate_mime_type, validate_file_size
- ✅ Thumbnail utils (app/utils/thumbnails.py) - 200x200 thumbnails via Pillow for jpg/png/webp
- ✅ Files router (app/routers/files.py) - GET/POST/GET/DELETE endpoints registered in main.py
- ✅ Backend tests (tests/test_files.py) - 43 tests, all passing, 82% coverage
## Blockers
- None
### Frontend
- ✅ Files lib (lib/files.ts) - API functions, types, utilities
- ✅ FileUpload component - Drag-and-drop multi-file upload
- ✅ FileList component - File list with thumbnails, delete confirm dialog
- ✅ FileGallery component - Gallery view for vehicle images
- ✅ FilePreview component - File preview modal
- ✅ Frontend tests (tests/files.test.tsx) - 25 tests, all passing
- ✅ TypeScript build check passes
## Notes
- PostgreSQL test DB (erp_test) and user (erp_test_user) set up locally
- Next.js 14.2.5 has security vulnerability warning - upgrade recommended later
- node_modules installed via npm install (294 packages)
- OPENROUTER_API_KEY added to config.py (empty default, needs env var in production)
- MAX_FILE_SIZE_MB=50 added to config.py
- @vitest/coverage-v8 not installed (frontend coverage runs without it)
### Acceptance Criteria Met
- ✅ GET /api/v1/vehicles/:id/files → 200 + list of files
- ✅ POST /api/v1/vehicles/:id/files mit multipart image → 201 + file object
- ✅ POST /api/v1/vehicles/:id/files mit >20MB file → 413
- ✅ POST /api/v1/vehicles/:id/files mit invalid MIME type → 422
- ✅ GET /api/v1/vehicles/:id/files/:fileId → 200 + file content (download)
- ✅ DELETE /api/v1/vehicles/:id/files/:fileId → 200 + file deleted
- ✅ File gespeichert in uploads_data volume, path in DB gespeichert
- ✅ Image files → Thumbnail generiert (200x200)
- ✅ Frontend File Upload akzeptiert Drag-and-Drop multi-file
- ✅ Frontend File List zeigt Thumbnails für images
- ✅ Frontend File Delete zeigt Confirm Dialog
- ✅ Frontend Gallery view für Fahrzeug-Bilder
- ✅ pytest coverage >= 80% für file module (82%)