package repuestos import ( "net/http" "strconv" r "repuestera_back/repositorios" "github.com/gin-gonic/gin" ) func ObtenerRepuesto(c *gin.Context) { id, err := strconv.ParseUint(c.Param("id"), 10, 64) if err != nil { c.JSON(http.StatusBadRequest, gin.H{"error": "ID invalido"}) return } repuesto, err := r.ObtenerRepositorios(c).Repuesto.ObtenerPorID(uint(id)) if err != nil { c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) return } c.JSON(http.StatusOK, repuesto) }