chore: update admin apis

This commit is contained in:
Krispire Admin
2026-06-16 15:48:44 +05:30
parent 4c42d9a7f9
commit 04ad94ad3c
4 changed files with 35 additions and 16 deletions
+2 -1
View File
@@ -290,7 +290,7 @@ func (s *Server) initAuth(cfg *config.Config, logger *zap.Logger) {
// Reuses the notification service (delivery) and mailer (feedback reply).
// Gated by RequireAuth + RequireAdmin in the router.
adminRepo := repository.NewAdminRepo(s.pg)
adminSvc := service.NewAdminService(adminRepo, notifSvc, feedbackSvc, mail, logger, cfg.FrontendURL)
adminSvc := service.NewAdminService(adminRepo, statsRepo, notifSvc, feedbackSvc, mail, logger, cfg.FrontendURL)
s.adminH = handler.NewAdminHandler(adminSvc)
}
@@ -986,6 +986,7 @@ func (s *Server) setupRouter() {
}
r.Use(middleware.RequireAuth(s.authIssuer, s.userRepo))
r.Use(middleware.RequireAdmin(s.userRepo))
r.Get("/stats", s.adminH.Stats)
r.Get("/users", s.adminH.ListUsers)
r.Post("/users/{id}/notify", s.adminH.NotifyUser)
r.Post("/users/{id}/ban", s.adminH.BanUser)