import { Entity, PrimaryGeneratedColumn, Column, ManyToOne, OneToOne, JoinColumn, Index, } from 'typeorm'; import { Email } from './email.entity'; import { Content } from './content.entity'; @Entity('Attachments') export class Attachment { @PrimaryGeneratedColumn({ type: 'int' }) Id!: number; @Index('IX_Attachments_EmailMessageId') @Column({ type: 'int' }) EmailMessageId!: number; @Column({ type: 'varchar', length: 255 }) FileName!: string; @Column({ type: 'varchar', length: 100 }) ContentType!: string; @Column({ type: 'tinyint', width: 1 }) Erechnung!: boolean; @Column({ type: 'varchar', length: 32, default: '' }) Checksum!: string; @Column({ type: 'varchar', length: 255, nullable: true }) ContentId!: string | null; @Column({ type: 'tinyint', width: 1 }) IsEmbedded!: boolean; @Index('IX_Attachments_ParentId') @Column({ type: 'int', nullable: true }) ParentId!: number | null; @Column({ type: 'json', nullable: true }) PaperlessDocumentIds!: any | null; @Column({ type: 'int', default: 0 }) ImportStatus!: number; @Column({ type: 'varchar', length: 255, nullable: true }) InterneBelegnummer!: string | null; @Column({ type: 'int', default: 0 }) PageCount!: number; @ManyToOne(() => Email, (email) => email.Attachments) @JoinColumn({ name: 'EmailMessageId' }) EmailMessage!: Email; @OneToOne(() => Content, (content) => content.AttachmentEntity) Content!: Content; }