feat(content): v2 扩展 Elective/LessonPlan/CoursePlan 三业务域

新增 3 个业务域(10 RPC):
- ElectiveService: 选修课列表/学生选课记录/选课/退课(含容量与重复校验)
- LessonPlanService: 教师备课列表/学生备课列表(仅 published)/详情
- CoursePlanService: 学生课程计划列表/详情
- KnowledgeGraphService.GetKnowledgePath: 与 GetLearningPath 同实现

新增 4 张 MySQL 表(elective_courses/selections/lesson_plans/course_plans),含完整索引。

新增 11 个权限点,覆盖 admin/teacher/student/parent 四角色。

proto 由 4 Service/22 RPC 扩展至 7 Service/32 RPC,v1 全部 RPC 保持向后兼容。

修复 logger.ts pino 导入: default import 在 NodeNext ESM 下不可调用,
改用 named import(与 iam/msg/core-edu 对齐)。

Docker 本地测试全部通过(HTTP + gRPC 双协议),健康检查、
Elective/LessonPlan/CoursePlan CRUD、4 个新 gRPC Service 全部验证通过。

nextstep-v2.md 已创建,记录上下游依赖与 6 项联调待办。
This commit is contained in:
SpecialX
2026-07-14 17:54:37 +08:00
parent abde336876
commit 78e406b317
32 changed files with 2086 additions and 13 deletions

View File

@@ -0,0 +1,42 @@
import { z } from "zod";
export const createElectiveCourseSchema = z.object({
title: z.string().min(1).max(255),
subjectId: z.string().min(1).max(32),
teacherId: z.string().min(1).max(32),
capacity: z.number().int().min(1).max(500).optional().default(30),
description: z.string().max(2000).optional(),
});
export const listAvailableElectiveCoursesSchema = z.object({
subjectId: z.string().optional(),
page: z.coerce.number().int().min(1).default(1),
pageSize: z.coerce.number().int().min(1).max(100).default(20),
});
export const listElectiveSelectionsSchema = z.object({
studentId: z.string().min(1).max(32),
status: z.string().optional(),
});
export const selectCourseSchema = z.object({
studentId: z.string().min(1).max(32),
courseId: z.string().min(1).max(32),
});
export const dropCourseSchema = z.object({
studentId: z.string().min(1).max(32),
courseId: z.string().min(1).max(32),
});
export type CreateElectiveCourseDto = z.infer<
typeof createElectiveCourseSchema
>;
export type ListAvailableElectiveCoursesDto = z.infer<
typeof listAvailableElectiveCoursesSchema
>;
export type ListElectiveSelectionsDto = z.infer<
typeof listElectiveSelectionsSchema
>;
export type SelectCourseDto = z.infer<typeof selectCourseSchema>;
export type DropCourseDto = z.infer<typeof dropCourseSchema>;