mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
21 lines
550 B
TypeScript
21 lines
550 B
TypeScript
import {Column, Entity, ManyToOne, PrimaryGeneratedColumn, Index} from 'typeorm';
|
|
import {DirectoryEntity} from './DirectoryEntity';
|
|
import {FileDTO} from '../../../../common/entities/FileDTO';
|
|
import {columnCharsetCS} from './EntityUtils';
|
|
|
|
|
|
@Entity()
|
|
export class FileEntity implements FileDTO {
|
|
|
|
@Index()
|
|
@PrimaryGeneratedColumn({unsigned: true})
|
|
id: number;
|
|
|
|
@Column(columnCharsetCS)
|
|
name: string;
|
|
|
|
@Index()
|
|
@ManyToOne(type => DirectoryEntity, directory => directory.metaFile, {onDelete: 'CASCADE'})
|
|
directory: DirectoryEntity;
|
|
}
|