address增加楼栋字段

This commit is contained in:
aaron 2025-01-06 01:04:37 +08:00
parent fd8e55e91a
commit 79d898ea97

View File

@ -11,6 +11,8 @@ class AddressDB(Base):
id = Column(Integer, primary_key=True, autoincrement=True)
user_id = Column(Integer, ForeignKey("users.userid"), index=True)
community_id = Column(Integer, index=True)
community_building_id = Column(Integer, ForeignKey("community_buildings.id"), nullable=True)
community_building_name = Column(String(100), nullable=True)
address_detail = Column(String(200))
name = Column(String(50))
phone = Column(String(11))
@ -21,6 +23,8 @@ class AddressDB(Base):
# Pydantic 模型
class AddressCreate(BaseModel):
community_id: int
community_building_id: Optional[int] = None
community_building_name: Optional[str] = Field(None, max_length=100)
address_detail: str = Field(..., max_length=200)
name: str = Field(..., max_length=50)
phone: str = Field(..., pattern="^1[3-9]\d{9}$")
@ -28,6 +32,8 @@ class AddressCreate(BaseModel):
class AddressUpdate(BaseModel):
community_id: Optional[int] = None
community_building_id: Optional[int] = None
community_building_name: Optional[str] = Field(None, max_length=100)
address_detail: Optional[str] = Field(None, max_length=200)
name: Optional[str] = Field(None, max_length=50)
phone: Optional[str] = Field(None, pattern="^1[3-9]\d{9}$")
@ -36,6 +42,8 @@ class AddressUpdate(BaseModel):
class AddressInfo(BaseModel):
id: int
community_id: int
community_building_id: Optional[int]
community_building_name: Optional[str]
address_detail: str
name: str
phone: str