后台所有的修改添加的操作都要对应人记录到操作日志里 ,除了GET之外都要记录
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
|
||||
from fastapi import APIRouter, Depends
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
@@ -21,6 +23,7 @@ from app.services.video_prompt_schema_config_service import (
|
||||
reset_video_prompt_schema_config,
|
||||
save_video_prompt_schema_config,
|
||||
)
|
||||
from app.services.operation_log import log_operation
|
||||
|
||||
router = APIRouter(prefix="/admin/video-prompt-schema-config", tags=["admin-video-prompt-schema-config"])
|
||||
|
||||
@@ -40,8 +43,22 @@ async def save_config(
|
||||
admin: User = Depends(get_admin_user),
|
||||
db: AsyncSession = Depends(get_db),
|
||||
):
|
||||
_ = admin
|
||||
return await save_video_prompt_schema_config(db, data=req.data, is_enabled=req.is_enabled)
|
||||
result = await save_video_prompt_schema_config(db, data=req.data, is_enabled=req.is_enabled)
|
||||
await log_operation(
|
||||
db,
|
||||
admin.id,
|
||||
admin.username,
|
||||
"保存视频提词 Schema 配置",
|
||||
"PUT",
|
||||
"/admin/video-prompt-schema-config",
|
||||
detail=json.dumps(
|
||||
{
|
||||
"is_enabled": req.is_enabled,
|
||||
},
|
||||
ensure_ascii=False,
|
||||
),
|
||||
)
|
||||
return result
|
||||
|
||||
|
||||
@router.post("/reset-default", response_model=VideoPromptSchemaConfigOut, summary="恢复默认视频提词 Schema 配置")
|
||||
@@ -49,8 +66,16 @@ async def reset_default(
|
||||
admin: User = Depends(get_admin_user),
|
||||
db: AsyncSession = Depends(get_db),
|
||||
):
|
||||
_ = admin
|
||||
return await reset_video_prompt_schema_config(db)
|
||||
result = await reset_video_prompt_schema_config(db)
|
||||
await log_operation(
|
||||
db,
|
||||
admin.id,
|
||||
admin.username,
|
||||
"恢复默认视频提词 Schema 配置",
|
||||
"POST",
|
||||
"/admin/video-prompt-schema-config/reset-default",
|
||||
)
|
||||
return result
|
||||
|
||||
|
||||
@router.get("/export", response_model=VideoPromptSchemaExportOut, summary="导出视频提词 Schema 配置")
|
||||
@@ -68,8 +93,22 @@ async def import_config(
|
||||
admin: User = Depends(get_admin_user),
|
||||
db: AsyncSession = Depends(get_db),
|
||||
):
|
||||
_ = admin
|
||||
return await import_video_prompt_schema_config(db, data=req.data, is_enabled=req.is_enabled)
|
||||
result = await import_video_prompt_schema_config(db, data=req.data, is_enabled=req.is_enabled)
|
||||
await log_operation(
|
||||
db,
|
||||
admin.id,
|
||||
admin.username,
|
||||
"导入视频提词 Schema 配置",
|
||||
"POST",
|
||||
"/admin/video-prompt-schema-config/import",
|
||||
detail=json.dumps(
|
||||
{
|
||||
"is_enabled": req.is_enabled,
|
||||
},
|
||||
ensure_ascii=False,
|
||||
),
|
||||
)
|
||||
return result
|
||||
|
||||
|
||||
@router.post("/preview", response_model=VideoPromptSchemaPreviewOut, summary="预览视频提词运行时 Schema")
|
||||
|
||||
Reference in New Issue
Block a user