Private
Public Access
hecho para poder cargar una reserva desde el facturas venta
Signed-off-by: fede <federico.nicolas.polidoro@gmail.com>
This commit is contained in:
1 parent
1073c69d5c
commit
ab59bd7043
20 files changed
+293
-90
No files matched your search
@@ -18,10 +18,11 @@ func ActualizarEmpresa(c *gin.Context) {
|
||||
}
|
||||
|
||||
var req struct {
|
||||
Nombre string `json:"nombre"`
|
||||
Slug string `json:"slug"`
|
||||
Cuit *string `json:"cuit"`
|
||||
Activa *bool `json:"activa"`
|
||||
Nombre string `json:"nombre"`
|
||||
Slug string `json:"slug"`
|
||||
Cuit *string `json:"cuit"`
|
||||
EmailAlertaStock *[]string `json:"email_alerta_stock"`
|
||||
Activa *bool `json:"activa"`
|
||||
}
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
||||
@@ -49,6 +50,19 @@ func ActualizarEmpresa(c *gin.Context) {
|
||||
empresa.Cuit = &cuit
|
||||
}
|
||||
}
|
||||
if req.EmailAlertaStock != nil {
|
||||
limpios := make([]string, 0, len(*req.EmailAlertaStock))
|
||||
vistos := make(map[string]bool)
|
||||
for _, email := range *req.EmailAlertaStock {
|
||||
email = strings.TrimSpace(email)
|
||||
if email == "" || vistos[email] {
|
||||
continue
|
||||
}
|
||||
vistos[email] = true
|
||||
limpios = append(limpios, email)
|
||||
}
|
||||
empresa.EmailAlertaStock = limpios
|
||||
}
|
||||
if req.Activa != nil {
|
||||
empresa.Activa = *req.Activa
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user