import { Entity, PrimaryGeneratedColumn, Column, ManyToOne, JoinColumn, Check } from 'typeorm'; import { License } from './license.entity'; @Entity('map_library') @Check(`"map_type" IN ('custom', 'procedural')`) export class MapLibrary { @PrimaryGeneratedColumn('uuid') id: string; @Column({ type: 'uuid' }) license_id: string; @Column({ type: 'varchar', length: 255 }) filename: string; @Column({ type: 'varchar', length: 255 }) display_name: string; @Column({ type: 'text' }) storage_path: string; @Column({ type: 'bigint', default: 0 }) file_size_bytes: number; @Column({ type: 'varchar', length: 20, default: 'custom' }) map_type: string; @Column({ type: 'integer', nullable: true }) seed: number | null; @Column({ type: 'integer', nullable: true }) world_size: number | null; @Column({ type: 'text', nullable: true }) thumbnail_path: string | null; @Column({ type: 'varchar', length: 64 }) checksum: string; @Column({ type: 'timestamptz', default: () => 'NOW()' }) uploaded_at: Date; @ManyToOne(() => License, { onDelete: 'CASCADE' }) @JoinColumn({ name: 'license_id' }) license: License; }