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.save();
|
||||
});
|
||||
return cb(err, this.modelToEntity(scannedDirectory));
|
||||
return cb(err, this.modelToEntity(savedDir));
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private modelToEntity(directroy:any):Directory {
|
||||
console.log("modelToEntity");
|
||||
// console.log(directroy);
|
||||
let directoryEntity = new Directory(directroy._id);
|
||||
Utils.updateKeys(directoryEntity, directroy);
|
||||
directroy.photos.forEach((photo) => {
|
||||
let photoEntity = new Photo(null, null, null, null, null);
|
||||
Utils.updateKeys(photoEntity, photo);
|
||||
console.log(photoEntity);
|
||||
private modelToEntity(directoryModel:any):Directory {
|
||||
|
||||
let directoryEntity = new Directory(directoryModel._id, directoryModel.name, directoryModel.path, directoryModel.lastupdate, [], []);
|
||||
|
||||
directoryModel.photos.forEach((photo) => {
|
||||
let photoEntity = new Photo(photo._id, photo.name, null, photo.width, photo.height);
|
||||
directoryEntity.photos.push(photoEntity);
|
||||
});
|
||||
directroy.directories.forEach((dir) => {
|
||||
let dirEntity = new Directory(null, null, null, null, null, null);
|
||||
Utils.updateKeys(dirEntity, dir);
|
||||
console.log(dir);
|
||||
console.log(dirEntity);
|
||||
|
||||
directoryModel.directories.forEach((dir) => {
|
||||
let dirEntity = new Directory(dir._id, dir.name, dir.path, dir.lastupdate, [], []);
|
||||
directoryEntity.directories.push(dirEntity);
|
||||
});
|
||||
|
||||
|
@ -11,7 +11,9 @@
|
||||
</div>
|
||||
|
||||
<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">
|
||||
<gallery-directory *ngIf="directory" [directory]="directory"></gallery-directory>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user