Files
erp-nutzfahrzeuge/.a0/current_status.md
T
Leopoldadmin 2cf433a01c feat(T04): contact management + USt-IdNr. validation + contact UI
- Contact model: company, role (kaeufer/verkaeufer/beide), soft-delete
- ContactPerson model: 1:N relation with CASCADE delete
- USt-IdNr. validation: DE + 10 EU countries
- Contact CRUD: 7 API endpoints with RBAC, search/filter/paginate
- Frontend: ContactList, ContactForm, ContactDetail with EU/Inland toggle
- 73 backend tests (91% coverage), 20 frontend tests
2026-07-14 12:14:21 +02:00

2.3 KiB
Raw Blame History

Current Status

Task: T04 Kontakt-/Kundenverwaltung + Contact UI Status: COMPLETED Date: 2026-07-14

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.

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

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

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