refactor(modules): update classes, course-plans, diagnostic, questions, settings, student, layout

- Update classes data-access (invitations, main) for invitation management

- Update course-plans actions, data-access, and types

- Update diagnostic data-access for report queries

- Update questions data-access for question bank queries

- Update settings actions, ai-provider-settings-card, data-access, and types

- Update student course-filters, student-courses-view, student-schedule-filters, student-schedule-view

- Update layout app-sidebar, site-header, and navigation config
This commit is contained in:
SpecialX
2026-06-24 12:03:35 +08:00
parent c9e46f9f80
commit 8c2fe14c20
18 changed files with 712 additions and 189 deletions

View File

@@ -321,3 +321,37 @@ export const getKnowledgePointsForQuestions = cache(
return result
}
)
/**
* 跨模块接口:获取题目内容与类型(供 error-book 模块提取正确答案使用)。
*
* error-book 模块在采集错题时需要从题目内容中提取正确答案correctAnswer
* 此接口返回题目的 content 和 type由 error-book 模块调用
* `homework/lib/question-content-utils.ts` 中的纯函数进行提取。
*/
export type QuestionContentForErrorCollection = {
content: unknown
type: string
}
export const getQuestionsContentForErrorCollection = cache(
async (questionIds: string[]): Promise<Map<string, QuestionContentForErrorCollection>> => {
const result = new Map<string, QuestionContentForErrorCollection>()
const uniqueIds = Array.from(new Set(questionIds.filter((v): v is string => typeof v === "string" && v.length > 0)))
if (uniqueIds.length === 0) return result
const rows = await db
.select({
id: questions.id,
content: questions.content,
type: questions.type,
})
.from(questions)
.where(inArray(questions.id, uniqueIds))
for (const r of rows) {
result.set(r.id, { content: r.content, type: r.type })
}
return result
}
)