From a19aca34ad139f3b8547aa61f94f1ca674b17d55 Mon Sep 17 00:00:00 2001 From: Braun Patrik Date: Wed, 4 May 2016 19:05:19 +0200 Subject: [PATCH] type fixing --- backend/model/mongoose/MongoGalleryManager.ts | 2 +- backend/model/mongoose/MongoSearchManager.ts | 4 ++-- backend/model/mongoose/MongoUserManager.ts | 4 ++-- common/entities/Directory.ts | 4 ++-- common/entities/Photo.ts | 2 +- common/entities/User.ts | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/backend/model/mongoose/MongoGalleryManager.ts b/backend/model/mongoose/MongoGalleryManager.ts index ae3c3357..735702a8 100644 --- a/backend/model/mongoose/MongoGalleryManager.ts +++ b/backend/model/mongoose/MongoGalleryManager.ts @@ -16,7 +16,7 @@ export class MongoGalleryManager implements IGalleryManager{ let directoryName = path.basename(relativeDirectoryName); let directoryParent = path.join( path.dirname(relativeDirectoryName),"/"); - DirectoryModel.findOne({name:directoryName, path: directoryParent}).populate('photos').populate('directories').exec( (err,res) =>{ + DirectoryModel.findOne({name:directoryName, path: directoryParent}).populate('photos').populate('directories').exec( (err,res:any) =>{ if(err || !res){ return this.indexDirectory(relativeDirectoryName,cb); } diff --git a/backend/model/mongoose/MongoSearchManager.ts b/backend/model/mongoose/MongoSearchManager.ts index c9f7f59f..d781c23a 100644 --- a/backend/model/mongoose/MongoSearchManager.ts +++ b/backend/model/mongoose/MongoSearchManager.ts @@ -14,13 +14,13 @@ export class MongoSearchManager implements ISearchManager{ console.log("autocomplete: " + text); let items:Array = []; - PhotoModel.find({name: { $regex: text, $options: "i" } }).limit(10).select('name').exec( (err,res) =>{ + PhotoModel.find({name: { $regex: text, $options: "i" } }).limit(10).select('name').exec( (err,res:Array) =>{ if(err || !res){ return cb(err,null); } items = items.concat(this.encapsulateAutoComplete(res.map(r => r.name),AutoCompeleteTypes.image)); - DirectoryModel.find({name: { $regex: text, $options: "i" } }).limit(10).select('name').exec( (err,res) =>{ + DirectoryModel.find({name: { $regex: text, $options: "i" } }).limit(10).select('name').exec( (err,res:Array) =>{ if(err || !res){ return cb(err,null); } diff --git a/backend/model/mongoose/MongoUserManager.ts b/backend/model/mongoose/MongoUserManager.ts index 3b772610..89e724fd 100644 --- a/backend/model/mongoose/MongoUserManager.ts +++ b/backend/model/mongoose/MongoUserManager.ts @@ -9,13 +9,13 @@ export class MongoUserManager implements IUserManager { } public findOne(filter, cb:(error:any, result:User) => void) { - return UserModel.findOne(filter, function (err, result) { + return UserModel.findOne(filter, function (err, result:any) { return cb(err, result); }); } public find(filter, cb:(error:any, result:Array) => void) { - UserModel.find(filter, function (err, result) { + UserModel.find(filter, function (err, result:Array) { return cb(err, result); }); } diff --git a/common/entities/Directory.ts b/common/entities/Directory.ts index 22d512bb..3a439967 100644 --- a/common/entities/Directory.ts +++ b/common/entities/Directory.ts @@ -1,10 +1,10 @@ import {Photo} from "./Photo"; export class Directory{ - constructor(public id?:string, + constructor(public id?:number, public name?:string, public path?:string, public lastUpdate?:Date, - public directories:Array = [], + public directories:Array =[], public photos:Array = []){} } \ No newline at end of file diff --git a/common/entities/Photo.ts b/common/entities/Photo.ts index af94fe59..0074d003 100644 --- a/common/entities/Photo.ts +++ b/common/entities/Photo.ts @@ -1,7 +1,7 @@ import {Utils} from "../Utils"; import {Directory} from "./Directory"; export class Photo { - constructor(public id:string, public name:string, public width:number, public height:number) { + constructor(public id:number, public name:string, public width:number, public height:number) { } public static getThumbnailPath(directory:Directory,photo:Photo){ diff --git a/common/entities/User.ts b/common/entities/User.ts index 873407b0..9954e996 100644 --- a/common/entities/User.ts +++ b/common/entities/User.ts @@ -8,5 +8,5 @@ export enum UserRoles{ } export class User { - constructor(public id?:string,public name?:string, public password?:string, public role:UserRoles = UserRoles.User){} + constructor(public id?:number,public name?:string, public password?:string, public role:UserRoles = UserRoles.User){} } \ No newline at end of file