This commit is contained in:
Lizandro Guarnizo
2026-05-16 15:06:05 -05:00
parent fef471ff6c
commit 9820405475
3 changed files with 50 additions and 38 deletions
+11 -9
View File
@@ -20,9 +20,10 @@ type PortalUser struct {
ClienteID *uint `json:"cliente_id" gorm:"column:cliente_id;index"` // nil si es partner
Cliente *Cliente `json:"cliente" gorm:"foreignKey:ClienteID"`
Rol string `json:"rol" gorm:"column:rol;default:'cliente'"` // cliente|partner
Activo bool `json:"activo" gorm:"column:activo;default:true"`
Notas string `json:"notas" gorm:"column:notas;type:text"`
PortalAccesos []PortalAcceso `json:"portal_accesos" gorm:"foreignKey:PortalUserID"`
Activo bool `json:"activo" gorm:"column:activo;default:true"`
Notas string `json:"notas" gorm:"column:notas;type:text"`
TelegramChatID string `json:"telegram_chat_id" gorm:"column:telegram_chat_id"`
PortalAccesos []PortalAcceso `json:"portal_accesos" gorm:"foreignKey:PortalUserID"`
}
func (PortalUser) TableName() string { return "portal_users" }
@@ -71,12 +72,13 @@ func CreatePortalUser(u *PortalUser) error {
func UpdatePortalUser(u *PortalUser) error {
return app.Http.Database.DB.Model(&PortalUser{}).Where("id = ?", u.ID).Updates(map[string]interface{}{
"nombre": u.Nombre,
"email": u.Email,
"cliente_id": u.ClienteID,
"rol": u.Rol,
"activo": u.Activo,
"notas": u.Notas,
"nombre": u.Nombre,
"email": u.Email,
"cliente_id": u.ClienteID,
"rol": u.Rol,
"activo": u.Activo,
"notas": u.Notas,
"telegram_chat_id": u.TelegramChatID,
}).Error
}