1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00

type fixing

This commit is contained in:
Braun Patrik 2016-05-04 19:05:19 +02:00
parent 9f793851ce
commit a19aca34ad
6 changed files with 9 additions and 9 deletions

View File

@ -16,7 +16,7 @@ export class MongoGalleryManager implements IGalleryManager{
let directoryName = path.basename(relativeDirectoryName); let directoryName = path.basename(relativeDirectoryName);
let directoryParent = path.join( path.dirname(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){ if(err || !res){
return this.indexDirectory(relativeDirectoryName,cb); return this.indexDirectory(relativeDirectoryName,cb);
} }

View File

@ -14,13 +14,13 @@ export class MongoSearchManager implements ISearchManager{
console.log("autocomplete: " + text); console.log("autocomplete: " + text);
let items:Array<AutoCompleteItem> = []; let items:Array<AutoCompleteItem> = [];
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<any>) =>{
if(err || !res){ if(err || !res){
return cb(err,null); return cb(err,null);
} }
items = items.concat(this.encapsulateAutoComplete(res.map(r => r.name),AutoCompeleteTypes.image)); 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<any>) =>{
if(err || !res){ if(err || !res){
return cb(err,null); return cb(err,null);
} }

View File

@ -9,13 +9,13 @@ export class MongoUserManager implements IUserManager {
} }
public findOne(filter, cb:(error:any, result:User) => void) { 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); return cb(err, result);
}); });
} }
public find(filter, cb:(error:any, result:Array<User>) => void) { public find(filter, cb:(error:any, result:Array<User>) => void) {
UserModel.find(filter, function (err, result) { UserModel.find(filter, function (err, result:Array<any>) {
return cb(err, result); return cb(err, result);
}); });
} }

View File

@ -1,7 +1,7 @@
import {Photo} from "./Photo"; import {Photo} from "./Photo";
export class Directory{ export class Directory{
constructor(public id?:string, constructor(public id?:number,
public name?:string, public name?:string,
public path?:string, public path?:string,
public lastUpdate?:Date, public lastUpdate?:Date,

View File

@ -1,7 +1,7 @@
import {Utils} from "../Utils"; import {Utils} from "../Utils";
import {Directory} from "./Directory"; import {Directory} from "./Directory";
export class Photo { 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){ public static getThumbnailPath(directory:Directory,photo:Photo){

View File

@ -8,5 +8,5 @@ export enum UserRoles{
} }
export class User { 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){}
} }