fix: default option in attributes

This commit is contained in:
2025-11-03 10:43:10 +04:00
parent be878717e5
commit a7bda3d9f6
6 changed files with 24 additions and 21 deletions

View File

@ -1,5 +1,3 @@
from typing import Any
from schemas.base import BaseSchema
@ -15,7 +13,6 @@ class AttrSelectSchema(BaseSchema):
class AttrOptionSchema(BaseSchema):
id: int
label: str
value: Any
class AttrSelectWithOptionsSchema(AttrSelectSchema):

View File

@ -1,5 +1,6 @@
from typing import Optional, Any
from schemas.attr_select import AttrSelectSchema, AttrOptionSchema
from schemas.base import BaseSchema, BaseResponse
@ -12,16 +13,12 @@ class AttributeTypeSchema(BaseSchema):
name: str
class AttributeSelectSchema(BaseSchema):
id: int
label: str
class CreateAttributeSchema(BaseSchema):
label: str
is_applicable_to_group: bool
is_nullable: bool
default_value: Optional[Any]
default_option_id: Optional[int] = None
description: str
type_id: int
select_id: Optional[int] = None
@ -31,7 +28,8 @@ class AttributeSchema(CreateAttributeSchema):
id: int
is_built_in: bool
type: AttributeTypeSchema
select: Optional[AttributeSelectSchema]
default_option: Optional[AttrOptionSchema] = None
select: Optional[AttrSelectSchema]
class UpdateAttributeSchema(BaseSchema):
@ -39,6 +37,7 @@ class UpdateAttributeSchema(BaseSchema):
is_applicable_to_group: Optional[bool] = None
is_nullable: Optional[bool] = None
default_value: Optional[Any] = None
default_option_id: Optional[int] = None
description: Optional[str] = None
@ -52,7 +51,7 @@ class DealModuleAttributeSchema(BaseSchema):
original_label: str
value: Optional[Any]
type: AttributeTypeSchema
select: Optional[AttributeSelectSchema]
select: Optional[AttrSelectSchema]
default_value: Any
description: str
is_applicable_to_group: bool