prompt 8
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user