This commit is contained in:
2026-05-10 09:46:07 +12:00
parent cfc193b713
commit 2f2466ecac
81 changed files with 2571 additions and 413 deletions
+12 -9
View File
@@ -4,14 +4,16 @@ from pydantic import BaseModel, ConfigDict, Field
class MixIngredientCreate(BaseModel):
model_config = ConfigDict(extra="forbid")
raw_material_id: int
quantity_kg: float = Field(gt=0)
notes: str | None = None
notes: str | None = Field(default=None, max_length=1000)
class MixIngredientUpdate(BaseModel):
model_config = ConfigDict(extra="forbid")
quantity_kg: float | None = Field(default=None, gt=0)
notes: str | None = None
notes: str | None = Field(default=None, max_length=1000)
class MixIngredientRead(BaseModel):
@@ -26,20 +28,22 @@ class MixIngredientRead(BaseModel):
class MixCreate(BaseModel):
client_name: str
name: str
model_config = ConfigDict(extra="forbid")
client_name: str = Field(min_length=1, max_length=255)
name: str = Field(min_length=1, max_length=255)
status: str = "draft"
version: int = 1
notes: str | None = None
notes: str | None = Field(default=None, max_length=2000)
ingredients: list[MixIngredientCreate]
class MixUpdate(BaseModel):
client_name: str | None = None
name: str | None = None
model_config = ConfigDict(extra="forbid")
client_name: str | None = Field(default=None, min_length=1, max_length=255)
name: str | None = Field(default=None, min_length=1, max_length=255)
status: str | None = None
version: int | None = None
notes: str | None = None
notes: str | None = Field(default=None, max_length=2000)
class MixRead(BaseModel):
@@ -57,4 +61,3 @@ class MixRead(BaseModel):
mix_cost_per_kg: float | None
warnings: list[str]
model_config = ConfigDict(from_attributes=True)