规范接口方法写法
This commit is contained in:
+2
-2
@@ -7,7 +7,7 @@ from schemas.student import StudentCreate, StudentUpdate
|
||||
from dao import student as student_dao
|
||||
student_router = APIRouter()
|
||||
|
||||
@student_router.put("",summary='添加学生')
|
||||
@student_router.post("",summary='添加学生')
|
||||
def create_student(request:StudentCreate,db:Session = Depends(get_db)):
|
||||
d = request.model_dump()
|
||||
r = student_dao.create_students(d,db)
|
||||
@@ -15,7 +15,7 @@ def create_student(request:StudentCreate,db:Session = Depends(get_db)):
|
||||
raise HTTPException(status_code=500,detail='服务器繁忙,请稍后添加!')
|
||||
return {'code':200,'detail':"添加学生成功"}
|
||||
|
||||
@student_router.post("/{id}", summary="更新学生信息")
|
||||
@student_router.put("/{id}", summary="更新学生信息")
|
||||
def update_student(
|
||||
id: int,
|
||||
request: StudentUpdate,
|
||||
|
||||
Reference in New Issue
Block a user