2018-05-13 00:19:51 +08:00
|
|
|
import {PhotoDTO} from './PhotoDTO';
|
2016-12-28 03:55:51 +08:00
|
|
|
|
|
|
|
export interface DirectoryDTO {
|
2017-06-11 04:32:56 +08:00
|
|
|
id: number;
|
|
|
|
name: string;
|
|
|
|
path: string;
|
2017-07-20 02:47:09 +08:00
|
|
|
lastModified: number;
|
|
|
|
lastScanned: number;
|
2017-07-22 01:14:22 +08:00
|
|
|
isPartial?: boolean;
|
2017-06-11 04:32:56 +08:00
|
|
|
parent: DirectoryDTO;
|
|
|
|
directories: Array<DirectoryDTO>;
|
|
|
|
photos: Array<PhotoDTO>;
|
|
|
|
}
|
2017-07-08 06:18:24 +08:00
|
|
|
|
2017-07-09 18:03:17 +08:00
|
|
|
export module DirectoryDTO {
|
|
|
|
export const addReferences = (dir: DirectoryDTO): void => {
|
2017-07-08 06:18:24 +08:00
|
|
|
dir.photos.forEach((photo: PhotoDTO) => {
|
|
|
|
photo.directory = dir;
|
|
|
|
});
|
|
|
|
|
|
|
|
dir.directories.forEach((directory: DirectoryDTO) => {
|
|
|
|
addReferences(directory);
|
|
|
|
directory.parent = dir;
|
|
|
|
});
|
2018-05-13 00:19:51 +08:00
|
|
|
};
|
2017-07-08 06:18:24 +08:00
|
|
|
}
|