feat: printing attributes in cards on dashboard

This commit is contained in:
2025-03-14 11:33:50 +04:00
parent 069bab1c01
commit 0e6563f54d
5 changed files with 9 additions and 0 deletions

View File

@@ -42,6 +42,11 @@ class Attribute(BaseModel):
default=False, default=False,
comment='Применять ли изменения атрибута карточки ко всем карточкам в группе', 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) is_nullable: Mapped[bool] = mapped_column(default=False, nullable=False)
default_value: Mapped[bytes] = mapped_column(nullable=True) default_value: Mapped[bytes] = mapped_column(nullable=True)
is_deleted: Mapped[bool] = mapped_column(default=False) is_deleted: Mapped[bool] = mapped_column(default=False)

View File

@@ -20,6 +20,7 @@ class BaseAttributeSchema(BaseSchema):
label: str label: str
name: str name: str
is_applicable_to_group: bool is_applicable_to_group: bool
is_shown_on_dashboard: bool
is_nullable: bool is_nullable: bool
default_value: Optional[bool | int | float | str | date | datetime] default_value: Optional[bool | int | float | str | date | datetime]
type_id: int type_id: int

View File

@@ -43,6 +43,7 @@ class CardSummary(BaseSchema):
base_marketplace: Optional[BaseMarketplaceSchema] = None base_marketplace: Optional[BaseMarketplaceSchema] = None
total_products: int total_products: int
tags: list[CardTagSchema] tags: list[CardTagSchema]
attributes: list[CardAttributeSchema]
shipment_warehouse_id: Optional[int] shipment_warehouse_id: Optional[int]
shipment_warehouse_name: Optional[str] shipment_warehouse_name: Optional[str]

View File

@@ -69,6 +69,7 @@ class AttributeService(BaseService):
attribute.label = request.attribute.label attribute.label = request.attribute.label
attribute.default_value = default_value attribute.default_value = default_value
attribute.is_applicable_to_group = request.attribute.is_applicable_to_group 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.is_nullable = request.attribute.is_nullable
attribute.description = request.attribute.description attribute.description = request.attribute.description
await self.session.commit() await self.session.commit()

View File

@@ -242,6 +242,7 @@ class CardsService(BaseService):
total_products=products_count, total_products=products_count,
bill_request=card.bill_request, bill_request=card.bill_request,
tags=card.tags, tags=card.tags,
attributes=card.attributes,
) )
) )
return CardSummaryResponse(summaries=summaries) return CardSummaryResponse(summaries=summaries)