fix: ia controller soporta OpenAI-compatible + native Ollama; TelegramChatID en Users
This commit is contained in:
+7
-7
@@ -30,6 +30,7 @@ type Users struct {
|
||||
NumeroMedidor string `json:"numero_medidor" gorm:"numero_medidor"`
|
||||
TelefonoFijo string `json:"telefono_fijo" gorm:"telefono_fijo"`
|
||||
Celular string `json:"celular" gorm:"celular"`
|
||||
TelegramChatID string `json:"telegram_chat_id" gorm:"column:telegram_chat_id"`
|
||||
AceptoInfo bool `json:"acepto_info" gorm:"acepto_info"`
|
||||
}
|
||||
|
||||
@@ -103,16 +104,15 @@ func CreateUser(User Users) error {
|
||||
}
|
||||
|
||||
// UpdateUser updates an existing user
|
||||
func UpdateUser(userID uint, Name string, NombreUsuario string, Email string, RoleID int) error {
|
||||
// Crea un mapa con los campos a actualizar
|
||||
func UpdateUser(userID uint, Name string, NombreUsuario string, Email string, RoleID int, TelegramChatID string) error {
|
||||
updates := map[string]interface{}{
|
||||
"name": Name,
|
||||
"nombre_usuario": NombreUsuario,
|
||||
"email": Email,
|
||||
"role_id": RoleID,
|
||||
"name": Name,
|
||||
"nombre_usuario": NombreUsuario,
|
||||
"email": Email,
|
||||
"role_id": RoleID,
|
||||
"telegram_chat_id": TelegramChatID,
|
||||
}
|
||||
|
||||
// Realiza la actualización de los campos en la base de datos
|
||||
if err := app.Http.Database.DB.Model(&Users{}).Where("id = ?", userID).Updates(updates).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user