fix the bug from minjun' testing

This commit is contained in:
Sukchan Lee 2017-09-22 21:38:38 +09:00
parent d7e9814bee
commit c7fb169cb3
4 changed files with 9 additions and 6 deletions

View file

@ -34,13 +34,13 @@ co(function* () {
}
const db = yield mongoose.connect(process.env.DB_URI)
// FIXME : we need to implement landing page for inserting admin account
Account.findByUsername('admin', true, (err, account) => {
Account.count((err, count) => {
if (err) {
console.error(err);
throw err;
}
if (!account) {
if (!count) {
const newAccount = new Account();
newAccount.username = 'admin';
newAccount.roles = [ 'admin' ];