feat: add platform audit export

This commit is contained in:
Codex
2026-06-30 05:41:30 +08:00
parent c74432ce98
commit b9957d18d5
13 changed files with 422 additions and 69 deletions

View File

@@ -223,6 +223,18 @@ export interface PlatformAuditLogItem {
createdAt?: string | null;
}
export interface PlatformAuditExportItem {
filename?: string | null;
format?: string | null;
mimeType?: string | null;
rowCount?: number | string | null;
exportedAt?: string | null;
sha256?: string | null;
sizeBytes?: number | string | null;
contentBase64?: string | null;
filters?: Record<string, unknown> | null;
}
export interface CreatePlatformTenantInput {
slug: string;
name: string;
@@ -342,6 +354,23 @@ export async function loadPlatformAuditLogs(query: { tenantId?: string; action?:
});
}
export async function exportPlatformAuditLogs(query: {
tenantId?: string;
action?: string;
targetType?: string;
actorUserId?: string;
q?: string;
startDate?: string;
endDate?: string;
format?: 'csv' | 'json';
limit?: number;
} = {}) {
return apiRequest<{ item?: PlatformAuditExportItem }>('/api/platform-admin/audit-logs/export', {
query: { format: 'csv', ...query, limit: query.limit || 1000 },
tenantId: null,
});
}
export async function loadPlatformInvoices(query: { tenantId?: string; status?: string; limit?: number } = {}) {
return apiRequest<{ items?: PlatformInvoiceItem[] }>('/api/platform-admin/invoices', {
query: { ...query, limit: query.limit || 80 },