feat(repairs): add repair documents

This commit is contained in:
Schubert Ferenc 2026-07-05 00:34:57 +02:00
parent 884a20e043
commit 6e7e75f864
21 changed files with 1222 additions and 6 deletions

View file

@ -19,6 +19,16 @@ RepairStatus = Literal[
]
RepairPriority = Literal["low", "normal", "high", "urgent"]
RepairSource = Literal["manual", "website", "customer_portal", "email", "phone"]
RepairDocumentType = Literal[
"device_photo",
"fault_photo",
"measurement",
"estimate",
"repair_report",
"shipping",
"other",
]
RepairDocumentVisibility = Literal["internal", "customer"]
def normalize_text(value: object) -> str:
@ -222,3 +232,39 @@ class RepairNotificationEventResponse(BaseModel):
class RepairNotificationOverviewResponse(BaseModel):
templates: list[RepairNotificationTemplateResponse]
events: list[RepairNotificationEventResponse]
class RepairDocumentBase(BaseModel):
title: str = Field(min_length=1, max_length=255)
document_type: RepairDocumentType = "other"
visibility: RepairDocumentVisibility = "internal"
note: str | None = None
@field_validator("title", "note", mode="before")
@classmethod
def normalize_document_strings(cls, value: object) -> str | None:
if value is None:
return None
return normalize_text(value)
class RepairDocumentUpdate(RepairDocumentBase):
pass
class RepairDocumentResponse(RepairDocumentBase):
id: int
repair_id: int
original_filename: str
stored_filename: str
storage_path: str
mime_type: str
size_bytes: int
checksum_sha256: str
uploaded_by_user_id: int | None
uploaded_by_username: str = ""
uploaded_by_display_name: str = ""
created_at: datetime
updated_at: datetime
model_config = ConfigDict(from_attributes=True)