fix: 移除无用方法
This commit is contained in:
@@ -49,7 +49,7 @@ class ScriptCreateOut(BaseModel):
|
|||||||
|
|
||||||
class ScriptGetIn(BaseModel):
|
class ScriptGetIn(BaseModel):
|
||||||
mode: Literal["ALL", "Index", "Single"]
|
mode: Literal["ALL", "Index", "Single"]
|
||||||
ScriptId: Optional[str] = None
|
scriptId: Optional[str] = None
|
||||||
|
|
||||||
|
|
||||||
class ScriptGetOut(BaseModel):
|
class ScriptGetOut(BaseModel):
|
||||||
@@ -173,30 +173,13 @@ async def get_scripts(script: ScriptGetIn = Body(...)) -> ScriptGetOut:
|
|||||||
"""查询脚本"""
|
"""查询脚本"""
|
||||||
try:
|
try:
|
||||||
index, data = await Config.get_script(
|
index, data = await Config.get_script(
|
||||||
script.mode, uuid.UUID(script.ScriptId) if script.ScriptId else None
|
script.mode, uuid.UUID(script.scriptId) if script.scriptId else None
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return ScriptGetOut(code=500, status="error", message=str(e), index=[], data={})
|
return ScriptGetOut(code=500, status="error", message=str(e), index=[], data={})
|
||||||
return ScriptGetOut(index=index, data=data)
|
return ScriptGetOut(index=index, data=data)
|
||||||
|
|
||||||
|
|
||||||
@app.post(
|
|
||||||
"/api/get/scripts/{scriptId}",
|
|
||||||
summary="查询单个脚本",
|
|
||||||
response_model=ScriptGetOut,
|
|
||||||
status_code=200,
|
|
||||||
)
|
|
||||||
async def get_script(scriptId: str = Path(..., description="脚本ID")) -> ScriptGetOut:
|
|
||||||
"""
|
|
||||||
查询单个脚本
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
index, data = await Config.get_script("Single", uuid.UUID(scriptId))
|
|
||||||
except Exception as e:
|
|
||||||
return ScriptGetOut(code=500, status="error", message=str(e), index=[], data={})
|
|
||||||
return ScriptGetOut(index=index, data=data)
|
|
||||||
|
|
||||||
|
|
||||||
@app.post("/api/update/scripts/{scriptId}", summary="更新脚本")
|
@app.post("/api/update/scripts/{scriptId}", summary="更新脚本")
|
||||||
async def update_script(
|
async def update_script(
|
||||||
scriptId: str = Path(..., description="脚本ID"),
|
scriptId: str = Path(..., description="脚本ID"),
|
||||||
|
|||||||
Reference in New Issue
Block a user