feat(core-edu): 完整实现 core-edu 教学核心服务

包含 classes/exams/homework/grades/attendance/scheduling 域、outbox、iam-consumer、redis 配置等完整实现
This commit is contained in:
SpecialX
2026-07-10 19:08:56 +08:00
parent 06a646ea4e
commit 58c0ba1bd9
55 changed files with 4204 additions and 305 deletions

View File

@@ -4,13 +4,36 @@ package next_edu_cloud.events.v1;
// Cross-service event contracts published by CoreEdu via the transactional
// outbox pattern and consumed by downstream services (notifications, analytics,
// audit, etc.). Topics follow the convention edu.{domain}.events.
// audit, etc.).
//
// Topic naming follows the arbitration in coord-cross-review §3.1:
// edu.teaching.<aggregate>.<action>
//
// Event routing (TOPIC_MAP in outbox.publisher.ts):
// edu.exam.events <- exam.created / exam.updated / exam.deleted
// edu.homework.events <- homework.assigned / homework.submitted / homework.graded
// edu.grade.events <- grade.recorded / grade.updated
// edu.class.events <- class.transferred
// edu.teaching.exam.created <- ExamEvent.created
// edu.teaching.exam.updated <- ExamEvent.updated
// edu.teaching.exam.published <- ExamEvent.published
// edu.teaching.exam.submitted <- ExamEvent.submitted
// edu.teaching.exam.deleted <- ExamEvent.deleted
// edu.teaching.homework.assigned <- HomeworkEvent.assigned
// edu.teaching.homework.submitted <- HomeworkEvent.submitted
// edu.teaching.homework.graded <- HomeworkEvent.graded
// edu.teaching.grade.recorded <- GradeEvent.recorded
// edu.teaching.grade.updated <- GradeEvent.updated
// edu.teaching.attendance.recorded <- AttendanceEvent.recorded
// edu.teaching.class.transferred <- ClassEvent.transferred
//
// All events MUST include:
// - schema_version: event schema version (default "v1")
// - event_id: UUID for idempotent consumption
// - occurred_at: business timestamp (ms epoch)
// - metadata: { traceId, userId }
message EventMetadata {
string schema_version = 1;
string trace_id = 2;
string user_id = 3;
}
message ClassEvent {
string event_id = 1;
@@ -20,7 +43,7 @@ message ClassEvent {
string class_id = 5;
string name = 6;
string action = 7;
map<string, string> metadata = 8;
EventMetadata metadata = 8;
}
message ExamEvent {
@@ -30,9 +53,10 @@ message ExamEvent {
int64 occurred_at = 4;
string exam_id = 5;
string class_id = 6;
string title = 7;
string action = 8;
map<string, string> metadata = 9;
string subject_id = 7;
string title = 8;
string action = 9;
EventMetadata metadata = 10;
}
message HomeworkEvent {
@@ -42,9 +66,10 @@ message HomeworkEvent {
int64 occurred_at = 4;
string homework_id = 5;
string class_id = 6;
string title = 7;
string action = 8;
map<string, string> metadata = 9;
string subject_id = 7;
string title = 8;
string action = 9;
EventMetadata metadata = 10;
}
message GradeEvent {
@@ -55,6 +80,19 @@ message GradeEvent {
string grade_id = 5;
string student_id = 6;
string score = 7;
string action = 8;
map<string, string> metadata = 9;
string total_score = 8;
string action = 9;
EventMetadata metadata = 10;
}
message AttendanceEvent {
string event_id = 1;
string aggregate_id = 2;
string event_type = 3;
int64 occurred_at = 4;
string attendance_id = 5;
string schedule_id = 6;
string student_id = 7;
string status = 8;
EventMetadata metadata = 9;
}