forked from wangziqi/gongxue-base
fix: audit remediation — SSE user scoping, FK transactional safety, UI error handling
- H4: scoped SSE import progress to exact userId match; non-HTTP events excluded from all subscribers - H2: moved PRAGMA foreign_key_check inside SQLite transaction before COMMIT; violations rollback preserving old tables - M1: removed dead axios-style error branch from extractErrorMessage (interceptor already unwraps) - M2: split handleSave try/catch — save errors vs reload errors shown distinctly - M3: added provider field validation before AI config test request - Added SSE scoping regression tests (import service + controller) - Added FK check failure rollback test (database-migrations.spec) - Updated controller spec expectations for userId parameter Co-authored-by: Code Review <branch-review>
This commit is contained in:
@@ -10,10 +10,13 @@ import {
|
||||
} from 'typeorm';
|
||||
import { Student } from './student.entity';
|
||||
import { Class } from './class.entity';
|
||||
import { ClassSchedule } from './class-schedule.entity';
|
||||
import { AttendanceSession } from './attendance-session.entity';
|
||||
|
||||
@Entity('attendance_records')
|
||||
@Index(['classId', 'attendanceDate'])
|
||||
@Index(['studentId', 'attendanceDate'])
|
||||
@Index(['attendanceSessionId', 'studentId'], { unique: true })
|
||||
export class AttendanceRecord {
|
||||
@PrimaryGeneratedColumn()
|
||||
id: number;
|
||||
@@ -32,6 +35,23 @@ export class AttendanceRecord {
|
||||
@JoinColumn({ name: 'class_id' })
|
||||
class: Class;
|
||||
|
||||
@Column({ name: 'schedule_id', type: 'integer', nullable: true })
|
||||
scheduleId: number | null;
|
||||
|
||||
@ManyToOne(() => ClassSchedule, { onDelete: 'SET NULL', nullable: true })
|
||||
@JoinColumn({ name: 'schedule_id' })
|
||||
schedule: ClassSchedule | null;
|
||||
|
||||
@Column({ name: 'attendance_session_id', type: 'integer', nullable: true })
|
||||
attendanceSessionId: number | null;
|
||||
|
||||
@ManyToOne(() => AttendanceSession, (session) => session.records, {
|
||||
onDelete: 'SET NULL',
|
||||
nullable: true,
|
||||
})
|
||||
@JoinColumn({ name: 'attendance_session_id' })
|
||||
attendanceSession: AttendanceSession | null;
|
||||
|
||||
@Column({ name: 'attendance_date', type: 'date' })
|
||||
attendanceDate: string;
|
||||
|
||||
@@ -41,8 +61,8 @@ export class AttendanceRecord {
|
||||
@Column({ length: 20 })
|
||||
status: string;
|
||||
|
||||
@Column({ length: 200, nullable: true })
|
||||
remark: string;
|
||||
@Column({ type: 'varchar', length: 200, nullable: true })
|
||||
remark: string | null;
|
||||
|
||||
@Column({ name: 'source', length: 20, default: 'manual' })
|
||||
source: string;
|
||||
|
||||
Reference in New Issue
Block a user