修复商家商品接口 bug
This commit is contained in:
parent
26ef177e8e
commit
2e278a4025
@ -13,7 +13,6 @@ class MerchantProductDB(Base):
|
|||||||
id = Column(Integer, primary_key=True, autoincrement=True)
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||||
merchant_id = Column(Integer, ForeignKey("merchants.id", ondelete="CASCADE"), index=True)
|
merchant_id = Column(Integer, ForeignKey("merchants.id", ondelete="CASCADE"), index=True)
|
||||||
name = Column(String(100), nullable=False)
|
name = Column(String(100), nullable=False)
|
||||||
category_id = Column(Integer, ForeignKey("merchant_product_categories.id"), nullable=False)
|
|
||||||
image_url = Column(String(500), nullable=False)
|
image_url = Column(String(500), nullable=False)
|
||||||
product_price = Column(Float, nullable=False) # 原价
|
product_price = Column(Float, nullable=False) # 原价
|
||||||
sale_price = Column(Float, nullable=False) # 售价
|
sale_price = Column(Float, nullable=False) # 售价
|
||||||
@ -28,7 +27,6 @@ class MerchantProductDB(Base):
|
|||||||
class MerchantProductCreate(BaseModel):
|
class MerchantProductCreate(BaseModel):
|
||||||
merchant_id: int
|
merchant_id: int
|
||||||
name: str = Field(..., max_length=100)
|
name: str = Field(..., max_length=100)
|
||||||
category_id: int
|
|
||||||
image_url: str = Field(..., max_length=500)
|
image_url: str = Field(..., max_length=500)
|
||||||
product_price: float = Field(..., gt=0)
|
product_price: float = Field(..., gt=0)
|
||||||
sale_price: float = Field(..., gt=0)
|
sale_price: float = Field(..., gt=0)
|
||||||
@ -38,7 +36,6 @@ class MerchantProductCreate(BaseModel):
|
|||||||
|
|
||||||
class MerchantProductUpdate(BaseModel):
|
class MerchantProductUpdate(BaseModel):
|
||||||
name: Optional[str] = Field(None, max_length=100)
|
name: Optional[str] = Field(None, max_length=100)
|
||||||
category_id: Optional[int] = None
|
|
||||||
image_url: Optional[str] = Field(None, max_length=500)
|
image_url: Optional[str] = Field(None, max_length=500)
|
||||||
product_price: Optional[float] = Field(None, gt=0)
|
product_price: Optional[float] = Field(None, gt=0)
|
||||||
sale_price: Optional[float] = Field(None, gt=0)
|
sale_price: Optional[float] = Field(None, gt=0)
|
||||||
@ -50,8 +47,6 @@ class MerchantProductInfo(BaseModel):
|
|||||||
id: int
|
id: int
|
||||||
merchant_id: int
|
merchant_id: int
|
||||||
name: str
|
name: str
|
||||||
category_id: int
|
|
||||||
category_name: str # 通过关联查询获取
|
|
||||||
image_url: str
|
image_url: str
|
||||||
product_price: float
|
product_price: float
|
||||||
sale_price: float
|
sale_price: float
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user