mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
type fixing
This commit is contained in:
parent
9f793851ce
commit
a19aca34ad
@ -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);
|
||||
}
|
||||
|
@ -14,13 +14,13 @@ export class MongoSearchManager implements ISearchManager{
|
||||
|
||||
console.log("autocomplete: " + text);
|
||||
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){
|
||||
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<any>) =>{
|
||||
if(err || !res){
|
||||
return cb(err,null);
|
||||
}
|
||||
|
@ -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<User>) => void) {
|
||||
UserModel.find(filter, function (err, result) {
|
||||
UserModel.find(filter, function (err, result:Array<any>) {
|
||||
return cb(err, result);
|
||||
});
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import {Photo} from "./Photo";
|
||||
export class Directory{
|
||||
|
||||
constructor(public id?:string,
|
||||
constructor(public id?:number,
|
||||
public name?:string,
|
||||
public path?:string,
|
||||
public lastUpdate?:Date,
|
||||
|
@ -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){
|
||||
|
@ -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){}
|
||||
}
|
Loading…
Reference in New Issue
Block a user