diff options
Diffstat (limited to 'controllers/user.go')
| -rw-r--r-- | controllers/user.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/controllers/user.go b/controllers/user.go new file mode 100644 index 0000000..ea2008b --- /dev/null +++ b/controllers/user.go @@ -0,0 +1,24 @@ +package controllers + +import ( + "dove/services" + "dove/types" + "dove/utils/meta" + "dove/utils/shortcuts" + + "github.com/gofiber/fiber/v2" +) + +func CreateUser(context *fiber.Ctx) error { + body, parseError := meta.Body[types.CreateUserRequest](context) + if parseError != nil { + return shortcuts.BadRequest(context, parseError) + } + + serviceError := services.CreateUser(body) + if serviceError != nil { + return shortcuts.HandleError(context, serviceError) + } + + return shortcuts.Redirect(context, "dashboard.users") +}
\ No newline at end of file |
