package handler import ( "net/http" "github.com/gin-gonic/gin" "github.com/yuxingu/digital-psychology/apps/api/internal/explore" "github.com/yuxingu/digital-psychology/apps/api/pkg/response" ) // ExploreHandler serves the explore catalog. type ExploreHandler struct{} // Register mounts explore routes. func (h *ExploreHandler) Register(rg *gin.RouterGroup) { rg.GET("/explore/catalog", h.Catalog) rg.GET("/explore/catalog/:key", h.Category) } // Catalog handles GET /explore/catalog. func (h *ExploreHandler) Catalog(c *gin.Context) { response.OK(c, gin.H{"categories": explore.Catalog()}) } // Category handles GET /explore/catalog/:key. func (h *ExploreHandler) Category(c *gin.Context) { cat := explore.CategoryByKey(c.Param("key")) if cat == nil { response.Fail(c, http.StatusNotFound, 40402, "category not found") return } response.OK(c, cat) }