package handlers import ( "git.godopu.com/lab/landing_page/backend/internal/httpx" "git.godopu.com/lab/landing_page/backend/internal/repository" "github.com/gin-gonic/gin" ) type HomeHandler struct { repo *repository.HomeRepository } func NewHomeHandler(repo *repository.HomeRepository) *HomeHandler { return &HomeHandler{repo: repo} } func (h *HomeHandler) GetResearchProjects(c *gin.Context) { projects, err := h.repo.GetResearchProjects(c.Request.Context()) if err != nil { httpx.InternalServerError(c, "Failed to retrieve research projects: "+err.Error()) return } httpx.OK(c, projects) } func (h *HomeHandler) GetResearchAreas(c *gin.Context) { areas, err := h.repo.GetResearchAreas(c.Request.Context()) if err != nil { httpx.InternalServerError(c, "Failed to retrieve research areas: "+err.Error()) return } httpx.OK(c, areas) } func (h *HomeHandler) GetStatsSummary(c *gin.Context) { stats, err := h.repo.GetStatsSummary(c.Request.Context()) if err != nil { httpx.InternalServerError(c, "Failed to retrieve statistics summary: "+err.Error()) return } httpx.OK(c, stats) }