2016-12-27 20:55:51 +01:00
|
|
|
import {PhotoDTO} from "./PhotoDTO";
|
|
|
|
|
|
|
|
export interface DirectoryDTO {
|
2017-06-10 22:32:56 +02:00
|
|
|
id: number;
|
|
|
|
name: string;
|
|
|
|
path: string;
|
|
|
|
lastUpdate: number;
|
|
|
|
parent: DirectoryDTO;
|
|
|
|
directories: Array<DirectoryDTO>;
|
|
|
|
photos: Array<PhotoDTO>;
|
|
|
|
}
|
2017-07-08 00:18:24 +02:00
|
|
|
|
2017-07-09 12:03:17 +02:00
|
|
|
export module DirectoryDTO {
|
|
|
|
export const addReferences = (dir: DirectoryDTO): void => {
|
2017-07-08 00:18:24 +02:00
|
|
|
dir.photos.forEach((photo: PhotoDTO) => {
|
|
|
|
photo.directory = dir;
|
|
|
|
});
|
|
|
|
|
|
|
|
dir.directories.forEach((directory: DirectoryDTO) => {
|
|
|
|
addReferences(directory);
|
|
|
|
directory.parent = dir;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|