fix order form

This commit is contained in:
Раис Юсупалиев
2026-04-11 00:36:37 +03:00
parent 18f7e251e3
commit ab0b66e1c2
9 changed files with 269 additions and 36 deletions
+5 -3
View File
@@ -2,7 +2,7 @@
from typing import Literal
from pydantic import BaseModel, Field, model_validator
from pydantic import BaseModel, ConfigDict, Field, model_validator
class OrderPhone(BaseModel):
@@ -10,9 +10,11 @@ class OrderPhone(BaseModel):
class OrderParty(BaseModel):
model_config = ConfigDict(extra="forbid")
name: str = Field(min_length=1)
email: str = Field(min_length=1)
phones: list[OrderPhone] = Field(min_length=1)
phone: OrderPhone
@model_validator(mode="before")
@classmethod
@@ -50,7 +52,7 @@ class OrderCreateRequest(BaseModel):
recipient: OrderParty
from_location: OrderLocation
to_location: OrderLocation
services: list[OrderService] = Field(min_length=1)
services: list[OrderService] | None = Field(default=None, min_length=1)
packages: list[OrderPackage] = Field(min_length=1)