修改put和delete的路径参数为stu_id
This commit is contained in:
@@ -39,16 +39,16 @@ def create_emp_info(emp:EmploymentRequest=Form(),db=Depends(get_db)):
|
||||
raise HTTPException(status_code=500,detail='服务器繁忙,请稍后添加!')
|
||||
return r
|
||||
|
||||
@emp_api.put('/employment/students/{emp_id}',summary='更新学生就业信息')
|
||||
def update_emp_info(emp_id:int,emp:UpdateEmpRequest,db=Depends(get_db)):
|
||||
r = update_emp_dao(emp_id,emp.model_dump(exclude_unset=True),db)
|
||||
@emp_api.put('/employment/students/{stu_id}',summary='更新学生就业信息')
|
||||
def update_emp_info(stu_id:int,emp:UpdateEmpRequest,db=Depends(get_db)):
|
||||
r = update_emp_dao(stu_id,emp.model_dump(exclude_unset=True),db)
|
||||
if not r:
|
||||
raise HTTPException(status_code=500,detail='没有更新!')
|
||||
return {'code':200,'totals':r,'detail':'更新成功!'}
|
||||
|
||||
@emp_api.delete('/employment/{emp_id}',summary='删除学生就业信息')
|
||||
def delete_emp_info(emp_id:int=Path(description='序号'),db=Depends(get_db)):
|
||||
rows = delete_emp_dao(emp_id, db)
|
||||
@emp_api.delete('/employment/{stu_id}',summary='删除学生就业信息')
|
||||
def delete_emp_info(stu_id:int=Path(description='序号'),db=Depends(get_db)):
|
||||
rows = delete_emp_dao(stu_id, db)
|
||||
if not rows:
|
||||
raise HTTPException(status_code=500, detail='没有删除!')
|
||||
return {'code':200,'detail':'删除成功!'}
|
||||
|
||||
Reference in New Issue
Block a user