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

34 lines
816 B
TypeScript
Raw Normal View History

2016-12-28 03:55:51 +08:00
import {Table, Column, PrimaryGeneratedColumn, OneToMany, ManyToOne} from "typeorm";
import {DirectoryDTO} from "../../../../common/entities/DirectoryDTO";
import {PhotoEntity} from "./PhotoEntity";
@Table()
export class DirectoryEnitity implements DirectoryDTO {
@PrimaryGeneratedColumn()
id: number;
@Column({
length: 500
})
name: string;
@Column({
length: 500
})
path: string;
@Column('datetime')
public lastUpdate: Date;
@ManyToOne(type => DirectoryEnitity, directory => directory.directories)
public parent: DirectoryEnitity;
@OneToMany(type => DirectoryEnitity, dir => dir.parent)
public directories: Array<DirectoryEnitity>;
@OneToMany(type => PhotoEntity, photo => photo.directory)
public photos: Array<PhotoEntity>;
}