1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- from typing import Optional, List
- from pydantic import BaseModel
- from schemas.base import ListMixin
- # class CreateRegion(BaseModel):
- # code: str = Field(..., max_length=20, description="区域编号")
- # name: str = Field(..., max_length=40, description="区域名称")
- # pcode: str = Field(default="0", description="上级区域编码")
- # shortname: str = Field(max_length=40, default="", description="区域简称")
- # level: int = Field(
- # ...,
- # ge=1,
- # le=5,
- # description="地区级别,1:省/直辖市/自治区,2:地级市/地区/自治州/盟,3:市辖区/县级市/县,4:乡/镇,5:村")
- # citycode: str = Field(max_length=20, default="", description="区号")
- # zipcode: str = Field(max_length=20, default="", description="区号")
- # mergename: str = Field(max_length=100, default="", description="区号")
- # lng: float = Field(default=0, description="经度")
- # lat: float = Field(default=0, description="纬度")
- # pyname: str = Field(max_length=100, default="", description="拼音名称")
- # creator: int = Field(..., description="创建人")
- #
- #
- # class UpdateRegion(BaseModel):
- # code: str = Field(..., max_length=20, description="区域编号")
- # name: str = Field(..., max_length=40, description="区域名称")
- # pcode: str = Field(default="0", description="上级区域编码")
- # shortname: str = Field(max_length=40, default="", description="区域简称")
- # level: int = Field(
- # ...,
- # ge=1,
- # le=5,
- # description="地区级别,1:省/直辖市/自治区,2:地级市/地区/自治州/盟,3:市辖区/县级市/县,4:乡/镇,5:村")
- # citycode: str = Field(max_length=20, default="", description="区号")
- # zipcode: str = Field(max_length=20, default="", description="区号")
- # mergename: str = Field(max_length=100, default="", description="区号")
- # lng: float = Field(default=0, description="经度")
- # lat: float = Field(default=0, description="纬度")
- # pyname: str = Field(max_length=100, default="", description="拼音名称")
- # creator: int = Field(..., description="创建人")
- class RegionItem(BaseModel):
- id: int
- code: str
- name: str
- class Config:
- orm_mode = True
- class RegionInfo(RegionItem):
- pcode: str
- shortname: Optional[str] = ""
- level: int
- citycode: Optional[str] = ""
- zipcode: Optional[str] = ""
- mergename: Optional[str] = ""
- lng: Optional[float] = 0
- lat: Optional[float] = 0
- pyname: Optional[str] = ""
- # class RegionInfoAll(RegionInfo):
- # parent: Optional[RegionItem] = None
- class RegionList(ListMixin):
- data: List[RegionInfo] = []
- class RegionItemList(ListMixin):
- data: List[RegionItem] = []
- # class RegionDetail(DetailMixin):
- # data: Optional[RegionInfoAll] = None
|