1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00
pigallery2/common/entities/DirectoryDTO.ts
2017-07-08 00:18:24 +02:00

25 lines
533 B
TypeScript

import {PhotoDTO} from "./PhotoDTO";
export interface DirectoryDTO {
id: number;
name: string;
path: string;
lastUpdate: number;
parent: DirectoryDTO;
directories: Array<DirectoryDTO>;
photos: Array<PhotoDTO>;
}
export module DirectoryUtil {
export const addReferences = (dir: DirectoryDTO) => {
dir.photos.forEach((photo: PhotoDTO) => {
photo.directory = dir;
});
dir.directories.forEach((directory: DirectoryDTO) => {
addReferences(directory);
directory.parent = dir;
});
}
}