feat: add import job detail polling

This commit is contained in:
Codex
2026-06-29 13:59:11 +08:00
parent 7fc92986a5
commit c07c9866f2
14 changed files with 246 additions and 41 deletions

View File

@@ -46,17 +46,49 @@ export interface TenantStudentItem {
export interface ImportJobItem {
id: string;
importType?: string;
sourceFormat?: string;
status?: string;
sourceName?: string | null;
totalCount?: number;
validCount?: number;
successCount?: number;
errorCount?: number;
warningCount?: number;
insertedCount?: number;
updatedCount?: number;
skippedCount?: number;
executionMode?: string;
queuedAt?: string | null;
lockedAt?: string | null;
lockedBy?: string | null;
attemptCount?: number;
maxAttempts?: number;
nextAttemptAt?: string | null;
errorMessage?: string | null;
createdAt?: string;
updatedAt?: string;
finishedAt?: string | null;
summary?: Record<string, unknown>;
}
export interface ImportJobDetail {
item?: ImportJobItem;
issueSummary?: Record<string, number>;
itemStatusSummary?: Record<string, number>;
recentIssues?: ImportIssueItem[];
importPostCheck?: Record<string, unknown> | null;
worker?: {
executionMode?: string;
queuedAt?: string | null;
lockedAt?: string | null;
lockedBy?: string | null;
attemptCount?: number;
maxAttempts?: number;
nextAttemptAt?: string | null;
lastWorkerError?: Record<string, unknown>;
};
}
export interface ContentEntryAdminItem {
id: string;
name: string;
@@ -247,6 +279,10 @@ export async function loadImportJobs(limit = 20) {
return apiRequest<{ items?: ImportJobItem[] }>('/api/tenant-content/imports', { query: { limit } });
}
export async function loadImportJobDetail(jobId: string) {
return apiRequest<ImportJobDetail>('/api/tenant-content/imports/detail', { query: { jobId } });
}
export async function loadImportIssues(jobId: string) {
return apiRequest<{ items?: ImportIssueItem[] }>('/api/tenant-content/imports/issues', { query: { jobId } });
}