feat: printing attributes in cards on dashboard
This commit is contained in:
		@@ -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)
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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]
 | 
			
		||||
 
 | 
			
		||||
@@ -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()
 | 
			
		||||
 
 | 
			
		||||
@@ -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)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user