import { Entity, PrimaryGeneratedColumn, Column, ManyToOne, JoinColumn } from 'typeorm'; import { License } from './license.entity'; @Entity('alert_history') export class AlertHistory { @PrimaryGeneratedColumn('uuid') id: string; @Column({ type: 'uuid' }) license_id: string; @Column({ type: 'varchar', length: 50 }) alert_type: string; @Column({ type: 'varchar', length: 20 }) severity: string; @Column({ type: 'varchar', length: 255 }) title: string; @Column({ type: 'text' }) message: string; @Column({ type: 'jsonb', nullable: true }) metadata: Record | null; @Column({ type: 'boolean', default: false }) notified_discord: boolean; @Column({ type: 'boolean', default: false }) notified_pushbullet: boolean; @Column({ type: 'boolean', default: false }) notified_email: boolean; @Column({ type: 'timestamptz', default: () => 'NOW()' }) triggered_at: Date; @ManyToOne(() => License, { onDelete: 'CASCADE' }) @JoinColumn({ name: 'license_id' }) license: License; }