This commit is contained in:
Lizandro Guarnizo
2026-06-03 21:32:50 -05:00
parent f087fd46f1
commit c05a2a8137
10 changed files with 453 additions and 175 deletions
+3 -3
View File
@@ -46,14 +46,14 @@ func CreateVcf(c *fiber.Ctx) error {
defer os.Remove(tmpPath)
// 3. Subir a OSS
ossService, err := services.NewOSSServiceFromDB()
ossProvider, err := getOSSFromBody(c)
if err != nil {
return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{
"error": "Error de conexión con OSS",
})
}
if err := ossService.UploadFile(fileName, tmpPath); err != nil {
if err := ossProvider.UploadFile(fileName, tmpPath); err != nil {
log.Printf("Error subiendo archivo a OSS: %v", err)
return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{
"error": "Error subiendo archivo a OSS",
@@ -61,7 +61,7 @@ func CreateVcf(c *fiber.Ctx) error {
}
// 4. URL del archivo
url := fmt.Sprintf("https://%s.%s/%s", ossService.BucketName, ossService.Endpoint, fileName)
url := ossProvider.PublicURL(fileName)
// 5. Buscar si ya existe un registro con ese vcard_id
var existing models.VcfVcard