fix: usar Updates(map) en lugar de Updates(struct) para evitar error id en PostgreSQL
This commit is contained in:
+10
-1
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user