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

32 lines
996 B
TypeScript
Raw Normal View History

2016-03-19 04:36:58 +08:00
import {User} from "../../common/entities/User";
export class UserManager {
private static users = [new User(1,"TestUser","test@test.hu","122345")];
2016-03-19 04:36:58 +08:00
public static findOne(filter,cb:(error: any,result:User) => void){
return cb(null, UserManager.users[0]);
}
public static find(filter,cb:(error: any,result:Array<User>) => void){
return cb(null, UserManager.users);
}
public static createUser(user,cb:(error: any,result:User) => void){
2016-04-08 20:48:29 +08:00
UserManager.users.push(user);
return cb(null, user);
}
public static deleteUser(id:number,cb:(error: any,result:string) => void){
UserManager.users = UserManager.users.filter(u => u.id != id);
return cb(null, "ok");
}
public static changeRole(request:any,cb:(error: any,result:string) => void){
return cb(null,"ok");
}
public static changePassword(request:any,cb:(error: any,result:string) => void){
return cb(null,"ok");
2016-03-19 04:36:58 +08:00
}
}