worked on account creation

This commit is contained in:
Torkel Ödegaard
2015-01-20 16:29:48 +01:00
parent eec178458b
commit 9e6df378c3
5 changed files with 38 additions and 3 deletions
+15 -1
View File
@@ -24,8 +24,22 @@ func CreateAccount(cmd *m.CreateAccountCommand) error {
Updated: time.Now(),
}
_, err := sess.Insert(&account)
if _, err := sess.Insert(&account); err != nil {
return err
}
// create inital admin account user
user := m.AccountUser{
AccountId: account.Id,
UserId: cmd.UserId,
Role: m.ROLE_ADMIN,
Created: time.Now(),
Updated: time.Now(),
}
_, err := sess.Insert(&user)
cmd.Result = account
return err
})
}