package handlers import ( "visiona-local/server/internal/model" "github.com/gin-gonic/gin" ) type ModelHandler struct { repo *model.Repository } func NewModelHandler(repo *model.Repository) *ModelHandler { return &ModelHandler{repo: repo} } func (h *ModelHandler) ListModels(c *gin.Context) { filter := model.ModelFilter{ TaskType: c.Query("type"), Hardware: c.Query("hardware"), Query: c.Query("q"), } models, total := h.repo.List(filter) c.JSON(200, gin.H{ "success": true, "data": gin.H{ "models": models, "total": total, }, }) } func (h *ModelHandler) GetModel(c *gin.Context) { id := c.Param("id") m, err := h.repo.GetByID(id) if err != nil { c.JSON(404, gin.H{ "success": false, "error": gin.H{ "code": "MODEL_NOT_FOUND", "message": "Model not found", }, }) return } c.JSON(200, gin.H{"success": true, "data": m}) }