This commit is contained in:
fabio
2026-02-22 17:53:29 +01:00
parent c60ff109a4
commit 70e34465de
6 changed files with 150 additions and 4 deletions

View File

@@ -22,7 +22,9 @@ func RegisterRoutes(app *fiber.App, store *session.Store, database *gorm.DB, cfg
return fmt.Errorf("init auth service: %w", err)
}
authController := controllers.NewAuthController(authService)
usersController := controllers.NewUsersController(services.NewUsersService(database))
usersService := services.NewUsersService(database)
usersController := controllers.NewUsersController(usersService)
adminController := controllers.NewAdminController(usersService)
app.Get("/healthz", func(c *fiber.Ctx) error {
return c.SendStatus(fiber.StatusOK)
@@ -50,9 +52,8 @@ func RegisterRoutes(app *fiber.App, store *session.Store, database *gorm.DB, cfg
})
admin := app.Group("/admin", httpmw.RequireAuth(), httpmw.RequireAdmin())
admin.Get("/", func(c *fiber.Ctx) error {
return c.SendString("admin area")
})
admin.Get("/", adminController.Dashboard)
admin.Get("/users", adminController.Users)
return nil
}