feat(customers): add initial admin bootstrap and csv import

This commit is contained in:
DS | Schubert 2026-07-03 09:14:56 +02:00
parent c816e9869d
commit ecab0fe6b6
27 changed files with 1197 additions and 34 deletions

View file

@ -0,0 +1,49 @@
from typing import Literal
from pydantic import BaseModel, Field
ImportMode = Literal["create_only", "update_existing", "upsert"]
ImportAction = Literal["create", "update", "skip", "error"]
class CustomerImportIssue(BaseModel):
row: int
field: str = ""
message: str
class CustomerImportPreviewRow(BaseModel):
row: int
customer_number: str = ""
company_name: str = ""
action: ImportAction
errors: list[CustomerImportIssue] = Field(default_factory=list)
warnings: list[CustomerImportIssue] = Field(default_factory=list)
class CustomerImportSummary(BaseModel):
total_rows: int
valid_rows: int
error_count: int
warning_count: int
duplicate_count: int
create_count: int
update_count: int
skip_count: int
class CustomerImportPreviewResponse(BaseModel):
mode: ImportMode
summary: CustomerImportSummary
rows: list[CustomerImportPreviewRow]
errors: list[CustomerImportIssue]
warnings: list[CustomerImportIssue]
duplicates: list[CustomerImportIssue]
class CustomerImportCommitResponse(BaseModel):
mode: ImportMode
summary: CustomerImportSummary
created: int
updated: int
skipped: int

View file

@ -68,6 +68,8 @@ class RoleResponse(BaseModel):
class CurrentUserResponse(BaseModel):
id: int
first_name: str
last_name: str
username: str
email: str
role: str