task-123(记录与版本中心): 实现历史记录分页加载

新增 history-model.ts(历史行 snake 解析) 与 history-api.ts(GET /api/admin/history)。

TDD: task-123.test.ts 8 用例 RED→GREEN。
This commit is contained in:
2026-09-05 17:31:29 +08:00
parent 103cb28a1f
commit df8255c41e
3 changed files with 143 additions and 0 deletions
@@ -0,0 +1,12 @@
/** 历史记录列表加载适配(任务 123):GET /api/admin/history + 归一与解析。 */
import { http } from '@/api/http'
import { parseHistoryPage } from './history-model.ts'
import { normalizeHistoryParams, toHistoryListQuery, type HistoryListParams, type HistoryPageResult } from './history-dto.ts'
export const HISTORY_ENDPOINT = '/api/admin/history'
export async function fetchHistoryList(params: Partial<HistoryListParams> = {}): Promise<HistoryPageResult> {
const normalized = normalizeHistoryParams(params)
const { data } = await http.get<unknown>(HISTORY_ENDPOINT, { params: toHistoryListQuery(normalized) })
return parseHistoryPage(data)
}