agent-07 phase 2: fix test isolation + CSV import UI

- Fix conftest.py: commit after each request in override_get_db so
  preview_csv's rollback no longer wipes the shared registered_user
  (root cause of 401 cascade across test_user_import + test_personnel_number)
- Fix limiter.enabled=False in client fixture (blocks rate-limit 429)
- Fix user_import_service: allow reactivation when personnel number
  belongs to the same user being reactivated
- Fix test_personnel_number: use PATCH /companies/me (not /companies/{id})
  and add try/finally cleanup for personnel_number_required flag
- Frontend UsersPage: add CSV import modal with template download,
  preview/validation table, and guarded apply button

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-23 21:07:32 +02:00
parent 39a0e370bc
commit fbc04bc2c0
5 changed files with 217 additions and 24 deletions
+3 -3
View File
@@ -170,15 +170,15 @@ async def _process_import(
errors += 1
continue
# Personalnr.-Konflikt mit DB?
# Personalnr.-Konflikt mit DB? Eigene Nummer (Reaktivierung) zulassen.
if personnel_number:
taken = await db.scalar(
select(User.id).where(
select(User).where(
User.company_id == company_id,
User.personnel_number == personnel_number,
)
)
if taken is not None:
if taken is not None and taken.email.lower() != email:
items.append(ImportRowResult(
row=idx, email=email, personnel_number=personnel_number,
action="error", message="Personalnummer ist bereits vergeben.",