forked from wangziqi/gongxue-base
feat: add tenant content operations
This commit is contained in:
@@ -54,6 +54,7 @@ export interface ImportJobItem {
|
||||
warningCount?: number;
|
||||
createdAt?: string;
|
||||
updatedAt?: string;
|
||||
summary?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface ContentEntryAdminItem {
|
||||
@@ -68,12 +69,59 @@ export interface ContentEntryAdminItem {
|
||||
export interface PublicQuestionBankItem {
|
||||
grantId?: string;
|
||||
sourceQuestionBankId?: string;
|
||||
sourceQuestionBankName?: string;
|
||||
sourceRegionName?: string | null;
|
||||
name?: string;
|
||||
regionName?: string | null;
|
||||
grantScope?: string;
|
||||
questionCount?: number;
|
||||
adoptedId?: string | null;
|
||||
adoptionStatus?: string | null;
|
||||
syncStatus?: string | null;
|
||||
targetEntryId?: string | null;
|
||||
targetCollectionId?: string | null;
|
||||
copiedQuestionCount?: number;
|
||||
lastSyncedAt?: string | null;
|
||||
adoption?: Record<string, unknown> | null;
|
||||
}
|
||||
|
||||
export interface ImportIssueItem {
|
||||
id: string;
|
||||
rowNo?: number | null;
|
||||
severity?: string;
|
||||
code?: string;
|
||||
fieldPath?: string | null;
|
||||
message?: string;
|
||||
externalId?: string | null;
|
||||
itemStatus?: string | null;
|
||||
createdAt?: string;
|
||||
}
|
||||
|
||||
export interface ImportFieldMapping {
|
||||
importType?: string;
|
||||
title?: string;
|
||||
description?: string;
|
||||
fields?: Array<{
|
||||
field?: string;
|
||||
label?: string;
|
||||
required?: boolean;
|
||||
aliases?: string[];
|
||||
description?: string;
|
||||
example?: unknown;
|
||||
}>;
|
||||
requiredFields?: string[];
|
||||
}
|
||||
|
||||
export interface ImportTemplateItem {
|
||||
importType?: string;
|
||||
format?: string;
|
||||
fileName?: string;
|
||||
mimeType?: string;
|
||||
contentBase64?: string;
|
||||
contentPreview?: string;
|
||||
fields?: Record<string, unknown>[];
|
||||
}
|
||||
|
||||
export interface CouponItem {
|
||||
id: string;
|
||||
code: string;
|
||||
@@ -139,13 +187,58 @@ export async function loadImportJobs(limit = 20) {
|
||||
}
|
||||
|
||||
export async function loadImportIssues(jobId: string) {
|
||||
return apiRequest<{ items?: Record<string, unknown>[] }>('/api/tenant-content/imports/issues', { query: { jobId } });
|
||||
return apiRequest<{ items?: ImportIssueItem[] }>('/api/tenant-content/imports/issues', { query: { jobId } });
|
||||
}
|
||||
|
||||
export async function loadPublicQuestionBanks() {
|
||||
return apiRequest<{ items?: PublicQuestionBankItem[] }>('/api/tenant-content/public-question-banks');
|
||||
}
|
||||
|
||||
export async function adoptPublicQuestionBank(input: { grantId: string; entryName?: string; collectionName?: string; copyLimit?: number }) {
|
||||
return apiRequest<{ item?: Record<string, unknown> }>('/api/tenant-content/public-question-banks/adopt', {
|
||||
method: 'POST',
|
||||
body: input,
|
||||
});
|
||||
}
|
||||
|
||||
export async function syncPublicQuestionBank(input: { adoptionId: string; copyLimit?: number }) {
|
||||
return apiRequest<{ item?: Record<string, unknown>; sync?: Record<string, unknown> }>('/api/tenant-content/public-question-banks/sync', {
|
||||
method: 'POST',
|
||||
body: input,
|
||||
});
|
||||
}
|
||||
|
||||
export async function loadPublicQuestionBankConflicts(adoptionId: string) {
|
||||
return apiRequest<{ item?: Record<string, unknown> }>('/api/tenant-content/public-question-banks/conflicts', {
|
||||
query: { adoptionId },
|
||||
});
|
||||
}
|
||||
|
||||
export async function runImportPostCheck(jobId: string) {
|
||||
return apiRequest<{ item?: Record<string, unknown> }>('/api/tenant-content/imports/post-check', {
|
||||
method: 'POST',
|
||||
body: { jobId },
|
||||
});
|
||||
}
|
||||
|
||||
export async function loadImportPostCheck(jobId: string) {
|
||||
return apiRequest<{ item?: Record<string, unknown> }>('/api/tenant-content/imports/post-check', {
|
||||
query: { jobId },
|
||||
});
|
||||
}
|
||||
|
||||
export async function loadImportFieldMapping(importType: string) {
|
||||
return apiRequest<{ item?: ImportFieldMapping }>('/api/tenant-content/imports/field-mapping', {
|
||||
query: { importType },
|
||||
});
|
||||
}
|
||||
|
||||
export async function loadImportTemplate(importType: string, format: 'json' | 'csv' = 'json') {
|
||||
return apiRequest<{ item?: ImportTemplateItem }>('/api/tenant-content/imports/templates', {
|
||||
query: { importType, format },
|
||||
});
|
||||
}
|
||||
|
||||
export async function loadCoupons() {
|
||||
return apiRequest<{ items?: CouponItem[] }>('/api/tenant-admin/coupons');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user