5bf43143ea
- Add clazz_audit_log table with diesel migration for CRUD audit trail - Add audit log backend: model, queries, handler, route - Add audit log viewer in clazz detail modal (操作记录) - Add student_lesson_stats API (GET /api/v1/clazz/stats/my-lessons) - Add teacher_detail_stats API (GET /api/v1/clazz/stats/teacher-detail) - Register all new routes in lib.rs Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
14 lines
425 B
SQL
14 lines
425 B
SQL
CREATE TABLE clazz_audit_log (
|
|
id VARCHAR PRIMARY KEY,
|
|
clazz_id VARCHAR NOT NULL,
|
|
action VARCHAR NOT NULL,
|
|
operator_hty_id VARCHAR NOT NULL,
|
|
operator_name VARCHAR,
|
|
changes JSONB,
|
|
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
|
org_id VARCHAR
|
|
);
|
|
|
|
CREATE INDEX idx_clazz_audit_log_clazz_id ON clazz_audit_log (clazz_id);
|
|
CREATE INDEX idx_clazz_audit_log_created_at ON clazz_audit_log (created_at);
|