feat: T04 fixes - i18n, auth tests, contact/vehicle test cleanup, status updates

This commit is contained in:
2026-07-14 20:16:15 +02:00
parent 2cf433a01c
commit b128ea6b39
16 changed files with 379 additions and 1004 deletions
+33 -25
View File
@@ -1,30 +1,38 @@
# Current Status
# Current Status ERP Nutzfahrzeuge
**Task**: T04 Kontakt-/Kundenverwaltung + Contact UI
**Status**: COMPLETED
**Date**: 2026-07-14
## Phase: Implementation (Phase 3)
## Plan-Mode: implementation_allowed
## Summary
Contact management backend (CRUD, search, filter, pagination, soft-delete, contact persons, USt-IdNr. validation) and frontend (ContactList, ContactForm, ContactDetail with EU/Inland toggle) implemented.
## Completed Tasks
- **T01** ✅ Auth + User Management + RBAC + Base Frontend + i18n (re-implemented, 50 backend + 16 frontend tests)
- **T02** ✅ Vehicle Management + mobile.de Push + Vehicle UI (commit 74b5e6a)
- **T04** ✅ Contact Management + USt-IdNr. Validation + Contact UI (commit 2cf433a)
## Backend (COMPLETED)
- Contact model: UUID PK, company_name, legal_form, address fields, address_country (ISO 3166-1 alpha-2), vat_id, phone, email, website, role (kaeufer/verkaeufer/beide), vat_id_status, is_private, timestamps, deleted_at soft-delete
- ContactPerson model: UUID PK, contact_id FK CASCADE, name, function, phone, email, created_at
- 7 API endpoints: GET /contacts (list+search+filter+sort+paginate), POST /contacts (create), GET /contacts/:id (detail+persons), PUT /contacts/:id (update), DELETE /contacts/:id (soft-delete), POST /contacts/:id/persons (add person), DELETE /contacts/:id/persons/:pid (remove person)
- Contact service: list_contacts (search, role filter with beide inclusion, is_eu filter, is_private filter, sort, pagination), get_contact_by_id, create_contact (with nested persons), update_contact, soft_delete_contact, add_contact_person, remove_contact_person
- USt-IdNr. validation: DE + 10 EU countries regex patterns, EU fallback, validate_vat_id, validate_vat_id_or_raise, get_country_code_from_vat_id
- RBAC: all roles read, admin+verkaeufer write (require_role dependency)
- Contacts router registered in main.py
## Test Results Summary
| Task | Backend Tests | Frontend Tests | Coverage |
|------|--------------|--------------|----------|
| T01 | 50 passed | 16 passed | 93% (auth_service 95%, routers 98%) |
| T02 | 73 passed | 16 passed | 82% |
| T04 | 73 passed | 20 passed | 91% |
## Frontend (COMPLETED)
- ContactList: Table with filters (search, role, EU/Inland, sort), pagination, error handling, loading state
- ContactForm: Create/edit form with USt-IdNr. validation, EU/Inland toggle (radio), country selector, role selector, legal form, address fields, contact info, is_private checkbox
- ContactDetail: All contact fields display, delete button, contact persons section with add/remove via Modal
- 3 pages: kontakte list, kontakte/neu create, kontakte/[id] detail
- lib/contacts.ts: Full API client with typed interfaces + validateVatIdFormat frontend validation
## Current Task: T03 OCR-Erfassung via OpenRouter Vision
- Dependencies: T01, T02 (both completed)
- OCRResult model, ocr_service, OCR router, async processing
- Frontend: OCR Upload (drag-and-drop), OCR Results view
## Test Evidence
- Backend: 73/73 pytest passed, 91% coverage on contact modules (service 99%, ust_validation 94%, models 93%, schemas 94%, router 67%)
- Frontend: 20/20 vitest passed
- test_report.md updated with full results
- All acceptance criteria verified and documented
## Git Status
- Branch: main
- Working tree: has uncommitted T01 changes
## Known Risks
- PostgreSQL must be running for backend tests
- Redis not installed (refresh tokens JWT-based, no async queue yet)
- No Alembic migrations yet (tables via Base.metadata.create_all)
- mobile.de push is synchronous (returns 202 but executes inline)
## Next Steps
1. Commit T01 changes
2. T03: OCR-Erfassung (ZB I/II) via OpenRouter Qwen2.5-VL
3. T05: Sales + Legal/Compliance
4. T06: KI Copilot
5. T08: Bildretusche