mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
27 lines
580 B
TypeScript
27 lines
580 B
TypeScript
import {MediaDTO} from './MediaDTO';
|
|
|
|
export interface DirectoryDTO {
|
|
id: number;
|
|
name: string;
|
|
path: string;
|
|
lastModified: number;
|
|
lastScanned: number;
|
|
isPartial?: boolean;
|
|
parent: DirectoryDTO;
|
|
directories: Array<DirectoryDTO>;
|
|
media: MediaDTO[];
|
|
}
|
|
|
|
export module DirectoryDTO {
|
|
export const addReferences = (dir: DirectoryDTO): void => {
|
|
dir.media.forEach((photo: MediaDTO) => {
|
|
photo.directory = dir;
|
|
});
|
|
|
|
dir.directories.forEach((directory: DirectoryDTO) => {
|
|
addReferences(directory);
|
|
directory.parent = dir;
|
|
});
|
|
};
|
|
}
|