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
+18
View File
@@ -0,0 +1,18 @@
package api
import (
"github.com/torkelo/grafana-pro/pkg/bus"
"github.com/torkelo/grafana-pro/pkg/middleware"
m "github.com/torkelo/grafana-pro/pkg/models"
)
func CreateAccount(c *middleware.Context, cmd m.CreateAccountCommand) {
cmd.UserId = c.UserId
if err := bus.Dispatch(&cmd); err != nil {
c.JsonApiErr(500, "Failed to create account", nil)
return
}
c.JsonOK("Account created")
}
+1
View File
@@ -49,6 +49,7 @@ func Register(r *macaron.Macaron) {
// account
r.Group("/account", func() {
r.Put("/", bind(m.CreateAccountCommand{}), CreateAccount)
r.Put("/users", bind(m.AddAccountUserCommand{}), AddAccountUser)
r.Get("/users", GetAccountUsers)
r.Delete("/users/:id", RemoveAccountUser)