task-278(验收反馈): 生成记录加清理数据功能(DELETE /api/admin/history 二次确认+条数提示;含工作区在途的 imagehistory 分页优化)

This commit is contained in:
2026-09-06 02:25:44 +08:00
parent 6d9b4a13ee
commit 648935e757
5 changed files with 140 additions and 15 deletions
@@ -17,3 +17,11 @@ export async function fetchHistoryUserOptions(): Promise<HistoryUserOption[]> {
const { data } = await http.get<unknown>('/api/admin/users', { params: { page: 1, page_size: 999 } })
return parseHistoryUserOptions(data)
}
/** 清空全部生成记录(验收反馈:生成记录数据要可清理)。返回清理条数。 */
export async function clearHistory(): Promise<number> {
const { data } = await http.delete<unknown>(HISTORY_ENDPOINT)
const record = data && typeof data === 'object' ? (data as Record<string, unknown>) : null
const removed = record?.data
return typeof removed === 'number' ? removed : 0
}