1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00
pigallery2/backend/model/sql/enitites/FileEntity.ts

21 lines
550 B
TypeScript
Raw Normal View History

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';
import {columnCharsetCS} from './EntityUtils';
2018-11-26 07:26:29 +08:00
@Entity()
export class FileEntity implements FileDTO {
@Index()
@PrimaryGeneratedColumn({unsigned: true})
2018-11-26 07:26:29 +08:00
id: number;
@Column(columnCharsetCS)
2018-11-26 07:26:29 +08:00
name: string;
@Index()
2018-11-26 07:26:29 +08:00
@ManyToOne(type => DirectoryEntity, directory => directory.metaFile, {onDelete: 'CASCADE'})
directory: DirectoryEntity;
}