package api import ( "net/http" "github.com/gin-gonic/gin" ) func (s *Server) listCountries(c *gin.Context) { items, err := s.app.Store.ListCountryStats(c.Request.Context()) if err != nil { c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) return } c.JSON(http.StatusOK, gin.H{"items": items}) } func (s *Server) rebuildCountries(c *gin.Context) { n, err := s.app.Store.RebuildAllNodeCountries(c.Request.Context()) if err != nil { c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) return } _ = s.app.ReloadEngine(c.Request.Context()) c.JSON(http.StatusOK, gin.H{"updated": n}) }