mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
fixing directory listing bugfix: converting mongoose doc to entity
This commit is contained in:
parent
c93c1aba2d
commit
deefd64d11
@ -52,29 +52,24 @@ export class MongoGalleryManager implements IGalleryManager {
|
|||||||
value['directory'] = savedDir;
|
value['directory'] = savedDir;
|
||||||
value.save();
|
value.save();
|
||||||
});
|
});
|
||||||
return cb(err, this.modelToEntity(scannedDirectory));
|
return cb(err, this.modelToEntity(savedDir));
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private modelToEntity(directroy:any):Directory {
|
private modelToEntity(directoryModel:any):Directory {
|
||||||
console.log("modelToEntity");
|
|
||||||
// console.log(directroy);
|
let directoryEntity = new Directory(directoryModel._id, directoryModel.name, directoryModel.path, directoryModel.lastupdate, [], []);
|
||||||
let directoryEntity = new Directory(directroy._id);
|
|
||||||
Utils.updateKeys(directoryEntity, directroy);
|
directoryModel.photos.forEach((photo) => {
|
||||||
directroy.photos.forEach((photo) => {
|
let photoEntity = new Photo(photo._id, photo.name, null, photo.width, photo.height);
|
||||||
let photoEntity = new Photo(null, null, null, null, null);
|
|
||||||
Utils.updateKeys(photoEntity, photo);
|
|
||||||
console.log(photoEntity);
|
|
||||||
directoryEntity.photos.push(photoEntity);
|
directoryEntity.photos.push(photoEntity);
|
||||||
});
|
});
|
||||||
directroy.directories.forEach((dir) => {
|
|
||||||
let dirEntity = new Directory(null, null, null, null, null, null);
|
directoryModel.directories.forEach((dir) => {
|
||||||
Utils.updateKeys(dirEntity, dir);
|
let dirEntity = new Directory(dir._id, dir.name, dir.path, dir.lastupdate, [], []);
|
||||||
console.log(dir);
|
|
||||||
console.log(dirEntity);
|
|
||||||
directoryEntity.directories.push(dirEntity);
|
directoryEntity.directories.push(dirEntity);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -11,7 +11,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div body class="container" style="width: 100%; padding:0" *ngIf="_galleryService.content.searchResult">
|
<div body class="container" style="width: 100%; padding:0" *ngIf="_galleryService.content.searchResult">
|
||||||
<div> Searching for: {{_galleryService.content.searchResult.searchText}}</div>
|
<ol class="breadcrumb">
|
||||||
|
<li class="active"> Searching for: <strong>{{_galleryService.content.searchResult.searchText}}</strong></li>
|
||||||
|
</ol>
|
||||||
<div *ngFor="let directory of _galleryService.content.searchResult.directories">
|
<div *ngFor="let directory of _galleryService.content.searchResult.directories">
|
||||||
<gallery-directory *ngIf="directory" [directory]="directory"></gallery-directory>
|
<gallery-directory *ngIf="directory" [directory]="directory"></gallery-directory>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user