import { Check, Column, CreateDateColumn, Entity, Index, PrimaryColumn, UpdateDateColumn, } from 'typeorm'; export type ArticleStatus = 'pending' | 'processing' | 'ready' | 'failed'; @Entity('rag_article') @Index('rag_article_dispatch_idx', ['status', 'createdAt', 'id']) @Check( 'rag_article_status_check', `"status" IN ('pending', 'processing', 'ready', 'failed')`, ) export class Article { @PrimaryColumn('uuid', { primaryKeyConstraintName: 'rag_article_pkey' }) id: string; @Column('uuid') storageKey: string; @Column('uuid', { nullable: true }) runToken: string | null; @Column({ length: 240 }) title: string; @Column({ length: 255 }) fileName: string; @Column({ length: 120 }) mimeType: string; @Column('integer') byteSize: number; @Column('varchar', { length: 2048, nullable: true }) sourceUrl: string | null; @Column('varchar', { length: 16 }) status: ArticleStatus; @Column('integer', { default: 1 }) generation: number; @Column('varchar', { length: 300, nullable: true }) embeddingModel: string | null; @Column('varchar', { length: 80, nullable: true }) errorCode: string | null; @CreateDateColumn({ type: 'timestamptz' }) createdAt: Date; @UpdateDateColumn({ type: 'timestamptz' }) updatedAt: Date; }