feat(repairs): add repair estimates

This commit is contained in:
Schubert Ferenc 2026-07-05 02:00:44 +02:00
parent 4436fe5f73
commit 111d8d12df
2 changed files with 103 additions and 15 deletions

View file

@ -31,6 +31,13 @@ class RepairEstimateItemPayload(BaseModel):
return None
return normalize_text(value)
@field_validator("quantity", mode="before")
@classmethod
def normalize_quantity(cls, value: object) -> object:
if isinstance(value, str):
return value.strip().replace(",", ".")
return value
class RepairEstimatePayload(BaseModel):
title: str = Field(min_length=1, max_length=255)
@ -53,6 +60,13 @@ class RepairEstimatePayload(BaseModel):
def normalize_currency(cls, value: str) -> str:
return value.upper() or "EUR"
@field_validator("tax_rate_percent", mode="before")
@classmethod
def normalize_tax_rate(cls, value: object) -> object:
if isinstance(value, str):
return value.strip().replace(",", ".")
return value
@model_validator(mode="after")
def validate_items(self):
if not self.items: