diff --git a/api/consultant.py b/api/consultant.py index 2e9a897..59be5b5 100644 --- a/api/consultant.py +++ b/api/consultant.py @@ -9,8 +9,7 @@ router = APIRouter() @router.get( path="/consultants", - tags=['顾问管理模块'] -) + tags=['顾问管理模块'],summary='顾问模糊分页查询') def read_consultants( db: Session = Depends(get_db), page:int=1, @@ -22,7 +21,7 @@ def read_consultants( -@router.post("/consultants", response_model=ConsultantResponse,tags=['顾问管理模块']) +@router.post("/consultants", response_model=ConsultantResponse,tags=['顾问管理模块'],summary='顾问增加') def create_consultant( obj_in: ConsultantCreate, db: Session = Depends(get_db) @@ -30,7 +29,7 @@ def create_consultant( return dao_consultant.create_consultant(db, obj_in) -@router.get("/consultants/{id}", response_model=ConsultantResponse,tags=['顾问管理模块']) +@router.get("/consultants/{id}", response_model=ConsultantResponse,tags=['顾问管理模块'],summary='顾问查询') def read_consultant(id: int, db: Session = Depends(get_db)): res = dao_consultant.get_consultant_by_id(db, cid=id) if res is None: @@ -41,8 +40,7 @@ def read_consultant(id: int, db: Session = Depends(get_db)): @router.put( path="/consultants/{id}", response_model=ConsultantResponse, - tags=['顾问管理模块'] -) + tags=['顾问管理模块'],summary='顾问更新') def update_consultant( id: int, obj_in: ConsultantUpdate, @@ -57,7 +55,7 @@ def update_consultant( -@router.delete("/consultants/{id}", response_model=ConsultantResponse,tags=['顾问管理模块']) +@router.delete("/consultants/{id}", response_model=ConsultantResponse,tags=['顾问管理模块'],summary='顾问删除') def delete_consultant(id: int, db: Session = Depends(get_db)): res = dao_consultant.delete_consultant(db, cid=id) if res is None: diff --git a/models/consultant.py b/models/consultant.py index 5f6f4ed..94702d7 100644 --- a/models/consultant.py +++ b/models/consultant.py @@ -8,7 +8,7 @@ class Consultant(Base): id = Column(Integer, primary_key=True, autoincrement=True, comment="主键") consultant_no = Column(String(50), unique=True, nullable=False, comment="顾问编号") consultant_name = Column(String(50), nullable=False, comment="顾问姓名") - phone = Column(String(11), nullable=True, comment="联系电话") + phone = Column(String(20), nullable=True, comment="联系电话") email = Column(String(100), nullable=True, comment="邮箱") remark = Column(String(255), nullable=True, comment="备注")