feat(portal-shell): restore codegen typescript-operations for data-ana domain (P1-7)
ARCHITECTURE.md §10 P1-7: dashboard domain's 6 operations strictly match the schema, so disable skipDocumentsValidation for that output and restore per-operation type generation. Changes: - codegen.yml: add dashboard-types.ts output (typescript + typescript-operations plugins, skipDocumentsValidation: false); move documents config into each generates entry - dashboard.ts: remove 14 handwritten interfaces and 6 internal query type aliases; derive types via NonNullable<GetXxxQuery['xxx']> so the public hook API shape stays unchanged - admin/student/teacher page.tsx: add ?? "--" / ?? 0 null guards on StatCard value props to match schema nullable semantics (parent page already uses toFixed chain, no change needed) Acceptance (ARCHITECTURE.md §10 P1-7): - codegen 3 outputs all SUCCESS - tsc 0 errors / eslint 0 errors / vitest 231 passed / next build ok - 6 operations strictly match schema with 0 errors Refs: ARCHITECTURE.md §5.3 data layer / §10 P1-7
This commit is contained in:
@@ -49,15 +49,19 @@ export default function AdminDashboardPage(): React.ReactElement {
|
||||
description="全校概览"
|
||||
stats={
|
||||
<>
|
||||
<StatCard title="教师总数" value={data.total_teachers} icon={Users} />
|
||||
<StatCard
|
||||
title="教师总数"
|
||||
value={data.total_teachers ?? "--"}
|
||||
icon={Users}
|
||||
/>
|
||||
<StatCard
|
||||
title="学生总数"
|
||||
value={data.total_students}
|
||||
value={data.total_students ?? "--"}
|
||||
icon={GraduationCap}
|
||||
/>
|
||||
<StatCard
|
||||
title="班级总数"
|
||||
value={data.total_classes}
|
||||
value={data.total_classes ?? "--"}
|
||||
icon={Building2}
|
||||
/>
|
||||
<StatCard
|
||||
|
||||
@@ -61,9 +61,9 @@ export default function StudentDashboardPage(): React.ReactElement {
|
||||
/>
|
||||
<StatCard
|
||||
title="待交作业"
|
||||
value={data.pending_homework}
|
||||
value={data.pending_homework ?? 0}
|
||||
icon={BookOpen}
|
||||
highlight={data.pending_homework > 0}
|
||||
highlight={(data.pending_homework ?? 0) > 0}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
|
||||
@@ -49,10 +49,14 @@ export default function TeacherDashboardPage(): React.ReactElement {
|
||||
description="今日教学概览"
|
||||
stats={
|
||||
<>
|
||||
<StatCard title="班级总数" value={data.total_classes} icon={Users} />
|
||||
<StatCard
|
||||
title="班级总数"
|
||||
value={data.total_classes ?? "--"}
|
||||
icon={Users}
|
||||
/>
|
||||
<StatCard
|
||||
title="学生总数"
|
||||
value={data.total_students}
|
||||
value={data.total_students ?? "--"}
|
||||
icon={GraduationCap}
|
||||
/>
|
||||
<StatCard
|
||||
@@ -62,9 +66,9 @@ export default function TeacherDashboardPage(): React.ReactElement {
|
||||
/>
|
||||
<StatCard
|
||||
title="待批作业"
|
||||
value={data.pending_homework_count}
|
||||
value={data.pending_homework_count ?? 0}
|
||||
icon={BookOpen}
|
||||
highlight={data.pending_homework_count > 0}
|
||||
highlight={(data.pending_homework_count ?? 0) > 0}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user