worked on account creation
This commit is contained in:
@@ -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")
|
||||
}
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user