2016-03-19 04:36:58 +08:00
|
|
|
import {User} from "../../common/entities/User";
|
|
|
|
export class UserManager {
|
|
|
|
|
2016-03-20 00:31:42 +08:00
|
|
|
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){
|
2016-03-20 00:31:42 +08:00
|
|
|
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
|
|
|
|
2016-03-20 00:31:42 +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
|
|
|
}
|
|
|
|
|
|
|
|
}
|