1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00
pigallery2/test/backend/initMongo.ts
2016-05-03 14:40:14 +02:00

35 lines
1.2 KiB
TypeScript

import {MongoUserManager} from "../../backend/model/mongoose/MongoUserManager";
import {User, UserRoles} from "../../common/entities/User";
import {DatabaseManager} from "../../backend/model/mongoose/DatabaseManager";
DatabaseManager.getInstance((err)=>{
DatabaseManager.getInstance().disconnect();
process.exit()
},()=>{
let userManager = new MongoUserManager();
userManager.createUser(new User(0,"demo","demo",UserRoles.Developer),(err)=>{
DatabaseManager.getInstance().disconnect();
process.exit()
});
userManager.createUser(new User(1,"developer","developer",UserRoles.Developer),(err)=>{
DatabaseManager.getInstance().disconnect();
process.exit()
});
userManager.createUser(new User(1,"admin","admin",UserRoles.Admin),(err)=>{
DatabaseManager.getInstance().disconnect();
process.exit()
});
userManager.createUser(new User(1,"user","user",UserRoles.User),(err)=>{
DatabaseManager.getInstance().disconnect();
process.exit()
});
userManager.createUser(new User(1,"guest","guest",UserRoles.Guest),(err)=>{
DatabaseManager.getInstance().disconnect();
process.exit()
});
});