update
This commit is contained in:
parent
34b7ecfcf1
commit
d6fcf919b3
@ -21,6 +21,7 @@ class MerchantDB(Base):
|
||||
|
||||
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||
user_id = Column(Integer, ForeignKey("users.userid"), nullable=False) # 归属用户
|
||||
community_id = Column(Integer, ForeignKey("communities.id"), nullable=False) # 所属小区
|
||||
name = Column(String(100), nullable=False)
|
||||
business_hours = Column(String(100), nullable=False) # 营业时间,如 "09:00-22:00"
|
||||
address = Column(String(200), nullable=False)
|
||||
@ -41,6 +42,7 @@ class MerchantDB(Base):
|
||||
|
||||
class MerchantCreate(BaseModel):
|
||||
user_id: int
|
||||
community_id: int # 所属小区ID
|
||||
name: str = Field(..., max_length=100)
|
||||
business_hours: str = Field(..., max_length=100)
|
||||
address: str = Field(..., max_length=200)
|
||||
@ -55,6 +57,7 @@ class MerchantCreate(BaseModel):
|
||||
|
||||
class MerchantApply(BaseModel):
|
||||
name: str = Field(..., max_length=100)
|
||||
community_id: int = Field(..., ge=0) # 所属小区ID
|
||||
business_hours: str = Field(..., max_length=100)
|
||||
address: str = Field(..., max_length=200)
|
||||
longitude: float = Field(..., ge=-180, le=180, description="经度")
|
||||
@ -70,6 +73,7 @@ class MerchantApply(BaseModel):
|
||||
|
||||
class MerchantUpdate(BaseModel):
|
||||
user_id: Optional[int] = None
|
||||
community_id: Optional[int] = None # 所属小区ID
|
||||
name: Optional[str] = Field(None, max_length=100)
|
||||
business_hours: Optional[str] = Field(None, max_length=100)
|
||||
address: Optional[str] = Field(None, max_length=200)
|
||||
@ -85,6 +89,8 @@ class MerchantUpdate(BaseModel):
|
||||
class MerchantInfo(BaseModel):
|
||||
id: int
|
||||
user_id: int
|
||||
community_id: int # 所属小区ID
|
||||
community_name: Optional[str] = None # 用于关联查询显示小区名称
|
||||
user_phone: Optional[str] = None
|
||||
user_nickname: Optional[str] = None
|
||||
online_pay_count: Optional[int] = 0
|
||||
|
||||
@ -154,4 +154,9 @@ ALTER TABLE merchant_orders
|
||||
ADD COLUMN product_delivery_deadline_time DATETIME COMMENT '配送截止时间快照' AFTER product_delivery_date;
|
||||
|
||||
|
||||
--====FINISH 3.23====
|
||||
--====FINISH 3.23====
|
||||
|
||||
ALTER TABLE merchants
|
||||
ADD COLUMN community_id INT COMMENT '所属小区' AFTER user_id,
|
||||
ADD CONSTRAINT fk_merchant_community
|
||||
FOREIGN KEY (community_id) REFERENCES communities(id)
|
||||
BIN
jobs.sqlite
BIN
jobs.sqlite
Binary file not shown.
Loading…
Reference in New Issue
Block a user