up
This commit is contained in:
@@ -28,8 +28,10 @@ type PortalUser struct {
|
||||
Telefono string `json:"telefono" gorm:"column:telefono"`
|
||||
Indicativo string `json:"indicativo" gorm:"column:indicativo"` // ej: +57, +1
|
||||
Pais string `json:"pais" gorm:"column:pais"`
|
||||
Documento string `json:"documento" gorm:"column:documento"` // RUT, NIT, CC, etc.
|
||||
Empresa string `json:"empresa" gorm:"column:empresa"` // empresa que representa
|
||||
Documento string `json:"documento" gorm:"column:documento"` // RUT, NIT, CC, etc.
|
||||
Empresa string `json:"empresa" gorm:"column:empresa"` // empresa que representa
|
||||
DocumentoRutFile string `json:"documento_rut_file" gorm:"column:documento_rut_file"` // ruta del archivo RUT
|
||||
DocumentoRutNombre string `json:"documento_rut_nombre" gorm:"column:documento_rut_nombre"` // nombre original
|
||||
PortalAccesos []PortalAcceso `json:"portal_accesos" gorm:"foreignKey:PortalUserID"`
|
||||
}
|
||||
|
||||
@@ -99,6 +101,17 @@ func UpdatePortalUserPassword(id uint, hashedPassword string) error {
|
||||
return app.Http.Database.DB.Model(&PortalUser{}).Where("id = ?", id).Update("password", hashedPassword).Error
|
||||
}
|
||||
|
||||
func UpdatePortalUserTelegramChatID(id uint, chatID string) error {
|
||||
return app.Http.Database.DB.Model(&PortalUser{}).Where("id = ?", id).Update("telegram_chat_id", chatID).Error
|
||||
}
|
||||
|
||||
func UpdatePortalUserRutFile(id uint, path, nombre string) error {
|
||||
return app.Http.Database.DB.Model(&PortalUser{}).Where("id = ?", id).Updates(map[string]interface{}{
|
||||
"documento_rut_file": path,
|
||||
"documento_rut_nombre": nombre,
|
||||
}).Error
|
||||
}
|
||||
|
||||
func DeletePortalUser(id uint) error {
|
||||
// Eliminar también sus accesos de partner
|
||||
if err := app.Http.Database.DB.Where("portal_user_id = ?", id).Delete(&PortalAcceso{}).Error; err != nil {
|
||||
|
||||
Reference in New Issue
Block a user