diff --git a/pkg/models/cliente.go b/pkg/models/cliente.go index 1a7661b..7ef28f7 100644 --- a/pkg/models/cliente.go +++ b/pkg/models/cliente.go @@ -59,7 +59,16 @@ func CreateCliente(c Cliente) error { } func UpdateCliente(c Cliente) error { - return app.Http.Database.DB.Model(&c).Updates(c).Error + return app.Http.Database.DB.Model(&Cliente{}).Where("id = ?", c.ID).Updates(map[string]interface{}{ + "nombre": c.Nombre, + "empresa": c.Empresa, + "email": c.Email, + "email_cc": c.EmailCC, + "telefono": c.Telefono, + "documento": c.Documento, + "notas": c.Notas, + "activo": c.Activo, + }).Error } func DeleteCliente(id uint) error { diff --git a/pkg/models/contrato.go b/pkg/models/contrato.go index fc35854..1a50508 100644 --- a/pkg/models/contrato.go +++ b/pkg/models/contrato.go @@ -86,7 +86,16 @@ func CreateContrato(c Contrato) error { } func UpdateContrato(c Contrato) error { - return app.Http.Database.DB.Model(&c).Updates(c).Error + return app.Http.Database.DB.Model(&Contrato{}).Where("id = ?", c.ID).Updates(map[string]interface{}{ + "cliente_id": c.ClienteID, + "servicio_id": c.ServicioID, + "fecha_inicio": c.FechaInicio, + "fecha_vencimiento": c.FechaVencimiento, + "precio_acordado": c.PrecioAcordado, + "estado": c.Estado, + "auto_renovar": c.AutoRenovar, + "notas": c.Notas, + }).Error } func DeleteContrato(id uint) error { diff --git a/pkg/models/servicio.go b/pkg/models/servicio.go index e959ae0..58c9d4b 100644 --- a/pkg/models/servicio.go +++ b/pkg/models/servicio.go @@ -57,7 +57,15 @@ func CreateServicio(s Servicio) error { } func UpdateServicio(s Servicio) error { - return app.Http.Database.DB.Model(&s).Updates(s).Error + return app.Http.Database.DB.Model(&Servicio{}).Where("id = ?", s.ID).Updates(map[string]interface{}{ + "nombre": s.Nombre, + "descripcion": s.Descripcion, + "precio": s.Precio, + "moneda": s.Moneda, + "tipo": s.Tipo, + "periodicidad": s.Periodicidad, + "activo": s.Activo, + }).Error } func DeleteServicio(id uint) error {