P3-02-03-04: audit log, batch ops, transactions

P3-02: audit-log.entity + service, manual logging in controller
  (startSession, submitAnswer, deleteSession, review, forceEnd)
P3-03: POST batch-delete, POST batch-export endpoints + service methods
P3-04: DataSource.transaction for deleteSession + reviewAssessment,
  graph state cleanup on session delete
This commit is contained in:
Developer
2026-05-19 09:52:31 +08:00
parent eb0798de5b
commit 7f8e7214b3
5 changed files with 197 additions and 57 deletions
@@ -0,0 +1,28 @@
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn } from 'typeorm';
@Entity('audit_logs')
export class AuditLog {
@PrimaryGeneratedColumn('uuid')
id: string;
@Column({ name: 'user_id', type: 'text' })
userId: string;
@Column({ name: 'tenant_id', nullable: true, type: 'text' })
tenantId: string;
@Column({ type: 'varchar', length: 50 })
action: string;
@Column({ name: 'resource_type', type: 'varchar', length: 50 })
resourceType: string;
@Column({ name: 'resource_id', nullable: true, type: 'text' })
resourceId: string;
@Column({ type: 'simple-json', nullable: true })
details: any;
@CreateDateColumn({ name: 'created_at' })
createdAt: Date;
}