feat(homework,classes,course-plans): add scans, student data, take confirm, error boundaries, dialogs, hooks, calendar
homework: - Add data-access-scans, data-access-student, data-access-utils, data-access-exam-cross - Add excellent-submissions, homework-take-confirm-dialog, homework-take-sidebar components classes: - Add class-delete-dialog, class-error-boundary, class-form-dialog, class-form-utils - Add class-list-table, class-list-toolbar, class-skeleton - Add schedule-create-dialog, schedule-delete-dialog, schedule-edit-dialog, schedule-utils - Add data-access-teacher and hooks directory course-plans: - Add course-plan-calendar, sortable-week-row, template-picker-dialog components - Add lib directory
This commit is contained in:
@@ -18,6 +18,19 @@ import {
|
||||
getSessionTeacherId,
|
||||
} from "./data-access"
|
||||
|
||||
/**
|
||||
* 根据课表项 ID 获取其所属班级 ID(P0-3 审计修复:供 actions-schedule 越权校验使用)。
|
||||
* classes 模块对 classSchedule 表有读权限(usedBy 含 classes)。
|
||||
*/
|
||||
export async function getClassIdByScheduleId(scheduleId: string): Promise<string | null> {
|
||||
const [row] = await db
|
||||
.select({ classId: classSchedule.classId })
|
||||
.from(classSchedule)
|
||||
.where(eq(classSchedule.id, scheduleId))
|
||||
.limit(1)
|
||||
return row?.classId ?? null
|
||||
}
|
||||
|
||||
const isWeekday = (n: unknown): n is 1 | 2 | 3 | 4 | 5 | 6 | 7 =>
|
||||
typeof n === "number" && n >= 1 && n <= 7 && Number.isInteger(n)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user