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
2016-12-28 15:35:27 +01:00

37 lines
884 B
TypeScript

import {Table, Column, PrimaryGeneratedColumn, OneToMany, ManyToOne} from "typeorm";
import {DirectoryDTO} from "../../../../common/entities/DirectoryDTO";
import {PhotoEntity} from "./PhotoEntity";
@Table()
export class DirectoryEntity implements DirectoryDTO {
@PrimaryGeneratedColumn()
id: number;
@Column({
length: 500
})
name: string;
@Column({
length: 500
})
path: string;
@Column('number')
public lastUpdate: number;
@Column({type: 'smallint', length: 1})
public scanned: boolean;
@ManyToOne(type => DirectoryEntity, directory => directory.directories)
public parent: DirectoryEntity;
@OneToMany(type => DirectoryEntity, dir => dir.parent)
public directories: Array<DirectoryEntity>;
@OneToMany(type => PhotoEntity, photo => photo.directory)
public photos: Array<PhotoEntity>;
}