mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
34 lines
816 B
TypeScript
34 lines
816 B
TypeScript
|
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>;
|
||
|
|
||
|
}
|