feat(settings,questions,school,textbooks): add brand config, question components, school dialogs, textbooks hooks
settings: - Add actions-brand, brand-config, data-access-brand for brand management - Add admin-file-upload-card, admin-notification-config-card, admin-school-info-card, admin-security-policy-card - Add ai-provider-delete-dialog, ai-provider-selector, brand-config-card - Add security-recent-logins-section, security-two-factor-section - Add config/profile-overview-config, data-access-profile-overview, lib/system-settings-utils questions: - Add batch-operations, import-export-buttons, knowledge-point-selector, options-editor - Add question-bank-results-client, question-cascade-filter, question-content-renderer, utils school: - Add grade-delete-dialog, grade-form-dialog, grade-list-toolbar, grade-overview-cards - Add use-grade-data hook textbooks: - Add textbook-form-fields component - Add use-kp-create, use-kp-delete, use-kp-update hooks
This commit is contained in:
46
src/modules/settings/data-access-profile-overview.ts
Normal file
46
src/modules/settings/data-access-profile-overview.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import "server-only"
|
||||
|
||||
import { getStudentClasses, getStudentSchedule } from "@/modules/classes/data-access"
|
||||
import { getStudentHomeworkAssignments } from "@/modules/homework/data-access-student"
|
||||
import { getStudentDashboardGrades } from "@/modules/homework/stats-service"
|
||||
import { getTeacherClasses, getTeacherTeachingSubjects } from "@/modules/classes/data-access"
|
||||
|
||||
/**
|
||||
* Profile 概览数据访问层
|
||||
*
|
||||
* 将 classes/homework 模块的 data-access 调用封装在 settings 模块内部,
|
||||
* 避免 settings 组件层直接 import 其他业务模块的 data-access。
|
||||
* 模块间通过 data-access 通信是允许的,组件层直接 import 则违反解耦原则。
|
||||
*/
|
||||
|
||||
/**
|
||||
* 获取学生概览所需的所有数据(并行查询)
|
||||
*/
|
||||
export async function getStudentProfileOverviewData(userId: string): Promise<{
|
||||
classes: Awaited<ReturnType<typeof getStudentClasses>>
|
||||
schedule: Awaited<ReturnType<typeof getStudentSchedule>>
|
||||
assignments: Awaited<ReturnType<typeof getStudentHomeworkAssignments>>
|
||||
grades: Awaited<ReturnType<typeof getStudentDashboardGrades>>
|
||||
}> {
|
||||
const [classes, schedule, assignments, grades] = await Promise.all([
|
||||
getStudentClasses(userId),
|
||||
getStudentSchedule(userId),
|
||||
getStudentHomeworkAssignments(userId),
|
||||
getStudentDashboardGrades(userId),
|
||||
])
|
||||
return { classes, schedule, assignments, grades }
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取教师概览所需的所有数据(并行查询)
|
||||
*/
|
||||
export async function getTeacherProfileOverviewData(): Promise<{
|
||||
subjects: Awaited<ReturnType<typeof getTeacherTeachingSubjects>>
|
||||
classes: Awaited<ReturnType<typeof getTeacherClasses>>
|
||||
}> {
|
||||
const [subjects, classes] = await Promise.all([
|
||||
getTeacherTeachingSubjects(),
|
||||
getTeacherClasses(),
|
||||
])
|
||||
return { subjects, classes }
|
||||
}
|
||||
Reference in New Issue
Block a user