icynet-auth-server/src/modules/objects/audit/audit.entity.ts

37 lines
747 B
TypeScript

import {
Column,
CreateDateColumn,
Entity,
ManyToOne,
PrimaryGeneratedColumn,
} from 'typeorm';
import { User } from '../user/user.entity';
@Entity()
export class AuditLog {
@PrimaryGeneratedColumn()
id: number;
@Column({ type: 'text', nullable: false })
action: string;
@Column({ type: 'text', nullable: true })
content: string;
@Column({ type: 'text', nullable: true })
actor_ip: string;
@Column({ type: 'text', nullable: true })
actor_ua: string;
/** Potentially unwanted behavior will be flagged by the system */
@Column({ default: false })
flagged: boolean;
@ManyToOne(() => User, { nullable: true, onDelete: 'SET NULL' })
public actor: User;
@CreateDateColumn()
public created_at: Date;
}