Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CI / CI OK (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
Lock Threads / action (push) Has been cancelled
Issue Close Require / close-issues (push) Has been cancelled
Close stale issues / stale (push) Has been cancelled
39 lines
1.0 KiB
TypeScript
39 lines
1.0 KiB
TypeScript
import { requestClient } from '#/api/request';
|
|
|
|
import type { SpreadsheetHistoryEntry } from '#/components/canvas-spreadsheet/types';
|
|
|
|
const prefix = 'spreadsheet-history/';
|
|
|
|
export async function saveSpreadsheetHistoryBatch(
|
|
entries: SpreadsheetHistoryEntry[],
|
|
) {
|
|
return requestClient.post<{ saved_ids: string[] }>(`${prefix}save-batch`, {
|
|
entries: entries.map((e) => ({
|
|
client_entry_id: e.id,
|
|
table_name: e.tableName,
|
|
sheet_key: e.sheetKey,
|
|
row_key: String(e.rowKey),
|
|
field_id: e.fieldId,
|
|
action: e.action,
|
|
before_snapshot: e.beforeSnapshot,
|
|
after_snapshot: e.afterSnapshot,
|
|
created_at: e.createdAt,
|
|
})),
|
|
});
|
|
}
|
|
|
|
export async function listSpreadsheetHistory(params: {
|
|
table_name: string;
|
|
sheet_key?: string;
|
|
page?: number;
|
|
pageSize?: number;
|
|
}) {
|
|
return requestClient.get<{ items: any[]; total: number }>(`${prefix}list`, {
|
|
params,
|
|
});
|
|
}
|
|
|
|
export async function rollbackSpreadsheetHistory(id: number) {
|
|
return requestClient.post<{ success: boolean }>(`${prefix}rollback`, { id });
|
|
}
|