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
@@ -16,12 +16,13 @@ import (
|
||||
|
||||
func CrearEmpresa(c *gin.Context) {
|
||||
var req struct {
|
||||
Nombre string `json:"nombre" binding:"required"`
|
||||
Slug string `json:"slug"`
|
||||
Cuit string `json:"cuit"`
|
||||
OwnerEmail string `json:"owner_email" binding:"required,email"`
|
||||
OwnerName string `json:"owner_name"`
|
||||
OwnerPassword string `json:"owner_password"`
|
||||
Nombre string `json:"nombre" binding:"required"`
|
||||
Slug string `json:"slug"`
|
||||
Cuit string `json:"cuit"`
|
||||
EmailAlertaStock []string `json:"email_alerta_stock"`
|
||||
OwnerEmail string `json:"owner_email" binding:"required,email"`
|
||||
OwnerName string `json:"owner_name"`
|
||||
OwnerPassword string `json:"owner_password"`
|
||||
}
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
||||
@@ -82,6 +83,17 @@ func CrearEmpresa(c *gin.Context) {
|
||||
cuit := strings.TrimSpace(req.Cuit)
|
||||
empresa.Cuit = &cuit
|
||||
}
|
||||
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 err := repo.Empresa.Crear(&empresa, owner.ID); err != nil {
|
||||
if creado {
|
||||
|
||||
Reference in new issue
Block a user