Spaces:
Sleeping
Sleeping
Download schemas/category.py from hsailorj/ymt-python: direct link, hf CLI and curl.
- Browser
- Download file 1.28 kB
-
https://huggingface.co/spaces/hsailorj/ymt-python/resolve/main/schemas/category.py
- Command line
-
hf download hf://spaces/hsailorj/ymt-python/schemas/category.py
-
curl -L -o category.py https://huggingface.co/spaces/hsailorj/ymt-python/resolve/main/schemas/category.py
1.28 kB
| from pydantic import BaseModel, Field | |
| from typing import Optional, List | |
| from datetime import datetime | |
| class CategoryBase(BaseModel): | |
| parent_code: str = Field(default="", description="父分类编码,空为顶级分类", max_length=100) | |
| code: str = Field(default="", description="分类编码,级联编码格式", max_length=100) | |
| name: str = Field(default="", description="分类名称", max_length=100) | |
| sort_order: int = Field(default=0, description="排序顺序") | |
| status: int = Field(default=1, description="状态:0-禁用,1-启用") | |
| company_code: str = Field(default="", description="公司编码", max_length=50) | |
| class CategoryCreate(CategoryBase): | |
| pass | |
| class CategoryUpdate(BaseModel): | |
| parent_code: Optional[str] = None | |
| code: Optional[str] = None | |
| name: Optional[str] = None | |
| sort_order: Optional[int] = None | |
| status: Optional[int] = None | |
| class CategoryResponse(CategoryBase): | |
| id: int | |
| created_at: datetime | |
| updated_at: datetime | |
| product_count: Optional[int] = 0 | |
| class Config: | |
| from_attributes = True | |
| class CategoryTreeResponse(CategoryResponse): | |
| children: List['CategoryTreeResponse'] = [] | |
| class Config: | |
| from_attributes = True | |
| CategoryTreeResponse.model_rebuild() | |