Private
Public Access
Update CrearRepuesto.go
This commit is contained in:
1 parent
643242e4af
commit
fce21846bc
1 file changed
+7
-4
@@ -4,7 +4,6 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
dto_builders "repuestera_back/dto/Builders"
|
dto_builders "repuestera_back/dto/Builders"
|
||||||
dto "repuestera_back/dto/Repuestos"
|
dto "repuestera_back/dto/Repuestos"
|
||||||
"repuestera_back/models"
|
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
|
||||||
@@ -19,10 +18,14 @@ func CrearRepuesto(c *gin.Context){
|
|||||||
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var marca models.Marca
|
|
||||||
marca = models.Marca{Nombre: data.Marca, ID: data.Marca[:3]}
|
|
||||||
|
|
||||||
if err := r.ObtenerRepositorios().Marca.CrearFaltante(marca); err != nil {
|
marca, err := r.ObtenerRepositorios().Marca.ObtenerPorID(data.Marca)
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := r.ObtenerRepositorios().Marca.CrearFaltante(*marca); err != nil {
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user