包含 classes/exams/homework/grades/attendance/scheduling 域、outbox、iam-consumer、redis 配置等完整实现
99 lines
2.7 KiB
Protocol Buffer
99 lines
2.7 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
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.).
|
|
//
|
|
// Topic naming follows the arbitration in coord-cross-review §3.1:
|
|
// edu.teaching.<aggregate>.<action>
|
|
//
|
|
// Event routing (TOPIC_MAP in outbox.publisher.ts):
|
|
// 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;
|
|
string aggregate_id = 2;
|
|
string event_type = 3;
|
|
int64 occurred_at = 4;
|
|
string class_id = 5;
|
|
string name = 6;
|
|
string action = 7;
|
|
EventMetadata metadata = 8;
|
|
}
|
|
|
|
message ExamEvent {
|
|
string event_id = 1;
|
|
string aggregate_id = 2;
|
|
string event_type = 3;
|
|
int64 occurred_at = 4;
|
|
string exam_id = 5;
|
|
string class_id = 6;
|
|
string subject_id = 7;
|
|
string title = 8;
|
|
string action = 9;
|
|
EventMetadata metadata = 10;
|
|
}
|
|
|
|
message HomeworkEvent {
|
|
string event_id = 1;
|
|
string aggregate_id = 2;
|
|
string event_type = 3;
|
|
int64 occurred_at = 4;
|
|
string homework_id = 5;
|
|
string class_id = 6;
|
|
string subject_id = 7;
|
|
string title = 8;
|
|
string action = 9;
|
|
EventMetadata metadata = 10;
|
|
}
|
|
|
|
message GradeEvent {
|
|
string event_id = 1;
|
|
string aggregate_id = 2;
|
|
string event_type = 3;
|
|
int64 occurred_at = 4;
|
|
string grade_id = 5;
|
|
string student_id = 6;
|
|
string score = 7;
|
|
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;
|
|
}
|