2019-01-07 06:15:52 +08:00
|
|
|
import {Column, Entity, ManyToOne, PrimaryGeneratedColumn, Index} from 'typeorm';
|
2018-11-26 07:26:29 +08:00
|
|
|
import {DirectoryEntity} from './DirectoryEntity';
|
|
|
|
import {FileDTO} from '../../../../common/entities/FileDTO';
|
2019-02-07 23:21:23 +08:00
|
|
|
import {columnCharsetCS} from './EntityUtils';
|
2018-11-26 07:26:29 +08:00
|
|
|
|
|
|
|
|
|
|
|
@Entity()
|
|
|
|
export class FileEntity implements FileDTO {
|
|
|
|
|
2019-01-07 06:15:52 +08:00
|
|
|
@Index()
|
2019-01-28 03:36:42 +08:00
|
|
|
@PrimaryGeneratedColumn({unsigned: true})
|
2018-11-26 07:26:29 +08:00
|
|
|
id: number;
|
|
|
|
|
2019-02-07 23:21:23 +08:00
|
|
|
@Column(columnCharsetCS)
|
2018-11-26 07:26:29 +08:00
|
|
|
name: string;
|
|
|
|
|
2019-01-07 06:15:52 +08:00
|
|
|
@Index()
|
2018-11-26 07:26:29 +08:00
|
|
|
@ManyToOne(type => DirectoryEntity, directory => directory.metaFile, {onDelete: 'CASCADE'})
|
|
|
|
directory: DirectoryEntity;
|
|
|
|
}
|