feat: 添加排序相关API

This commit is contained in:
DLmaster361
2025-08-05 01:08:34 +08:00
parent 911eb60ae9
commit 6fb4fa7683
4 changed files with 123 additions and 0 deletions

View File

@@ -70,6 +70,16 @@ async def delete_script(script: ScriptDeleteIn = Body(...)) -> OutBase:
return OutBase()
@router.post("/order", summary="重新排序脚本", response_model=OutBase, status_code=200)
async def reorder_script(script: ScriptReorderIn = Body(...)) -> OutBase:
try:
await Config.reorder_script(script.indexList)
except Exception as e:
return OutBase(code=500, status="error", message=str(e))
return OutBase()
@router.post(
"/user/add", summary="添加用户", response_model=UserCreateOut, status_code=200
)
@@ -101,3 +111,15 @@ async def delete_user(user: UserDeleteIn = Body(...)) -> OutBase:
except Exception as e:
return OutBase(code=500, status="error", message=str(e))
return OutBase()
@router.post(
"/user/order", summary="重新排序用户", response_model=OutBase, status_code=200
)
async def reorder_user(user: UserReorderIn = Body(...)) -> OutBase:
try:
await Config.reorder_user(user.scriptId, user.indexList)
except Exception as e:
return OutBase(code=500, status="error", message=str(e))
return OutBase()