import { Entity, PrimaryGeneratedColumn, Column, ManyToOne, JoinColumn, Check } from 'typeorm'; import { License } from './license.entity'; import { User } from './user.entity'; @Entity('chat_logs') @Check(`"channel" IN ('global', 'team', 'server')`) export class ChatLog { @PrimaryGeneratedColumn('uuid') id: string; @Column({ type: 'uuid' }) license_id: string; @Column({ type: 'varchar', length: 20 }) steam_id: string; @Column({ type: 'varchar', length: 100 }) player_name: string; @Column({ type: 'varchar', length: 20, default: 'global' }) channel: string; @Column({ type: 'text' }) message: string; @Column({ type: 'boolean', default: false }) flagged: boolean; @Column({ type: 'uuid', nullable: true }) flagged_by: string | null; @Column({ type: 'text', nullable: true }) flag_reason: string | null; @Column({ type: 'timestamptz', default: () => 'NOW()' }) created_at: Date; @ManyToOne(() => License, { onDelete: 'CASCADE' }) @JoinColumn({ name: 'license_id' }) license: License; @ManyToOne(() => User, { nullable: true }) @JoinColumn({ name: 'flagged_by' }) flagger: User | null; }