diff --git a/models/attribute.py b/models/attribute.py index eaee441..d0318a0 100644 --- a/models/attribute.py +++ b/models/attribute.py @@ -42,6 +42,11 @@ class Attribute(BaseModel): default=False, comment='Применять ли изменения атрибута карточки ко всем карточкам в группе', ) + is_shown_on_dashboard: Mapped[bool] = mapped_column( + default=False, + server_default='0', + comment='Отображается ли атрибут на дашборде', + ) is_nullable: Mapped[bool] = mapped_column(default=False, nullable=False) default_value: Mapped[bytes] = mapped_column(nullable=True) is_deleted: Mapped[bool] = mapped_column(default=False) diff --git a/schemas/attribute.py b/schemas/attribute.py index 6f8fc12..fb78821 100644 --- a/schemas/attribute.py +++ b/schemas/attribute.py @@ -20,6 +20,7 @@ class BaseAttributeSchema(BaseSchema): label: str name: str is_applicable_to_group: bool + is_shown_on_dashboard: bool is_nullable: bool default_value: Optional[bool | int | float | str | date | datetime] type_id: int diff --git a/schemas/card.py b/schemas/card.py index 5284bfc..488c68a 100644 --- a/schemas/card.py +++ b/schemas/card.py @@ -43,6 +43,7 @@ class CardSummary(BaseSchema): base_marketplace: Optional[BaseMarketplaceSchema] = None total_products: int tags: list[CardTagSchema] + attributes: list[CardAttributeSchema] shipment_warehouse_id: Optional[int] shipment_warehouse_name: Optional[str] diff --git a/services/attribute.py b/services/attribute.py index a29d464..5a8037d 100644 --- a/services/attribute.py +++ b/services/attribute.py @@ -69,6 +69,7 @@ class AttributeService(BaseService): attribute.label = request.attribute.label attribute.default_value = default_value attribute.is_applicable_to_group = request.attribute.is_applicable_to_group + attribute.is_shown_on_dashboard = request.attribute.is_shown_on_dashboard attribute.is_nullable = request.attribute.is_nullable attribute.description = request.attribute.description await self.session.commit() diff --git a/services/card.py b/services/card.py index be8300f..a773f54 100644 --- a/services/card.py +++ b/services/card.py @@ -242,6 +242,7 @@ class CardsService(BaseService): total_products=products_count, bill_request=card.bill_request, tags=card.tags, + attributes=card.attributes, ) ) return CardSummaryResponse(summaries=summaries)