feat: support daily practice exports

This commit is contained in:
Codex
2026-06-29 17:17:44 +08:00
parent 506d7015a0
commit 60501a0f70
11 changed files with 455 additions and 21 deletions

View File

@@ -2814,6 +2814,41 @@ async function testTenantContentAdmin() {
const exportedQuestionWithAnswer = paperExport.export?.questions?.find(item => item.id === question.item.id);
assert.equal(exportedQuestionWithAnswer?.answerText, '4', 'paper export should include answers when requested');
const dailyPracticeExport = await request('/api/tenant-content/exports/questions', {
userId: TENANT_ADMIN_USER_ID,
method: 'POST',
body: {
scopeType: 'collection',
scopeId: collection.item.id,
format: 'json',
exportType: 'daily_practice',
includeAnswers: true,
includeExplanations: false,
limit: 99,
options: {
title: '第 1 期每日一练',
issue: '每日一练 第 1 期',
date: '2026-06-29',
theme: 'ink',
cardFormat: '1:1',
brand: {
name: '恭学教育',
english: 'GONGXUE EDU',
slogan: '专注高职升本',
ctaLine: '每日一练 · 稳步上岸',
},
},
},
});
assert.equal(dailyPracticeExport.export?.exportType, 'daily_practice', 'daily practice export should use daily_practice type');
assert.equal(dailyPracticeExport.export?.summary?.issue, '每日一练 第 1 期', 'daily practice export should expose issue metadata');
assert.equal(dailyPracticeExport.export?.summary?.cardCount, 1, 'daily practice export should expose card count');
assert.equal(dailyPracticeExport.export?.dailyPractice?.slots?.some(item => item.slot === 4 && item.kind === 'center'), true, 'daily practice export should include center slot metadata');
assert.ok(
dailyPracticeExport.export?.questions?.length <= 8,
'daily practice export should cap question count for nine-grid material',
);
const pdfExportJob = await request('/api/tenant-content/exports/questions', {
userId: TENANT_ADMIN_USER_ID,
method: 'POST',