fix(model): update save method to use specific ID for record updates

This commit is contained in:
Chang lue Tsen 2025-09-16 11:20:48 -04:00
parent 596434454c
commit 4ad18a8b70

View File

@ -79,7 +79,7 @@ func (m *defaultServerModel) UpdateServer(ctx context.Context, data *Server, tx
if len(tx) > 0 {
db = tx[0]
}
return db.WithContext(ctx).Save(data).Error
return db.WithContext(ctx).Where("`id` = ?", data.Id).Save(data).Error
}
@ -115,7 +115,7 @@ func (m *defaultServerModel) UpdateNode(ctx context.Context, data *Node, tx ...*
if len(tx) > 0 {
db = tx[0]
}
return db.WithContext(ctx).Save(data).Error
return db.WithContext(ctx).Where("`id` = ?", data.Id).Save(data).Error
}
func (m *defaultServerModel) DeleteNode(ctx context.Context, id int64, tx ...*gorm.DB) error {