mirror of
https://git.rwth-aachen.de/acs/public/villas/web-backend-go/
synced 2025-03-30 00:00:12 +01:00
fix updating bool values of data models (incl. scenario IsLocked parameter #63)
This commit is contained in:
parent
cabb3ed7f7
commit
776e89eb90
3 changed files with 16 additions and 1 deletions
|
@ -52,6 +52,12 @@ func (s *InfrastructureComponent) update(updatedIC InfrastructureComponent) erro
|
|||
|
||||
db := database.GetDB()
|
||||
err := db.Model(s).Updates(updatedIC).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// extra update for bool ManagedExternally since it is ignored if false
|
||||
err = db.Model(s).Updates(map[string]interface{}{"ManagedExternally": updatedIC.ManagedExternally}).Error
|
||||
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -63,6 +63,12 @@ func (s *Scenario) update(updatedScenario Scenario) error {
|
|||
|
||||
db := database.GetDB()
|
||||
err := db.Model(s).Update(updatedScenario).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// extra update for bool IsLocked since it is ignored if false
|
||||
err = db.Model(s).Updates(map[string]interface{}{"IsLocked": updatedScenario.IsLocked}).Error
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -124,8 +124,11 @@ func (u *User) update(updatedUser User) error {
|
|||
|
||||
db := database.GetDB()
|
||||
err := db.Model(u).Update(updatedUser).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// extra update for bool active since it is ignored if false
|
||||
// extra update for bool Active since it is ignored if false
|
||||
err = db.Model(u).Updates(map[string]interface{}{"Active": updatedUser.Active}).Error
|
||||
|
||||
return err
|
||||
|
|
Loading…
Add table
Reference in a new issue