feat: add feedback resolver

This commit is contained in:
Krispire Admin
2026-06-03 23:43:17 +05:30
parent 61b91c473b
commit e9a96f1ff9
7 changed files with 211 additions and 16 deletions
+5 -1
View File
@@ -195,7 +195,7 @@ func (s *Server) initAuth(cfg *config.Config, logger *zap.Logger) {
statsRepo := repository.NewStatsRepo(s.pg)
feedbackSvc := service.NewFeedbackService(feedbackRepo, mail, cfg.FeedbackAdminEmails, logger)
s.feedbackH = handler.NewFeedbackHandler(feedbackSvc)
s.statsH = handler.NewStatsHandler(statsRepo, feedbackRepo)
s.statsH = handler.NewStatsHandler(statsRepo, feedbackRepo, feedbackSvc)
}
// initShortener wires Postgres + Redis + the shorturl handler/workers.
@@ -314,6 +314,10 @@ func (s *Server) setupRouter() {
// ever needs to change.
if s.statsH != nil {
r.Get("/stats", s.statsH.Render)
// One-way "mark resolved" per feedback row — POST so a refresh of
// /stats can't replay it, and it lives at the same public access
// level as /stats itself (gate both together if that changes).
r.Post("/stats/feedback/{id}/resolve", s.statsH.ResolveFeedback)
}
// API v1