From c0bf6f5156fab11ec93cd6f124de96746bba4b32 Mon Sep 17 00:00:00 2001 From: Marco Pedone Date: Fri, 8 Aug 2025 11:15:40 +0200 Subject: [PATCH] Add Og_url field to AnnuncioParsed and AnnunciDB for improved image handling --- apps/backend/miogest_handler.go | 6 ++++++ apps/backend/models.go | 2 ++ 2 files changed, 8 insertions(+) diff --git a/apps/backend/miogest_handler.go b/apps/backend/miogest_handler.go index a23ee8a..b2b8b4b 100644 --- a/apps/backend/miogest_handler.go +++ b/apps/backend/miogest_handler.go @@ -214,6 +214,7 @@ func extractData_update(annuncio *AnnuncioXML, updateImages bool) AnnuncioParsed } tmpcaratt := parseCaratteristiche(annuncio) tmp.Caratteristiche = &tmpcaratt + if updateImages { processImages(&tmp, annuncio) } @@ -372,6 +373,11 @@ func processImages(tmp *AnnuncioParsed, annuncio *AnnuncioXML) { if annuncio.Foto != nil { fotos = *annuncio.Foto } + tmp.Og_url = nil + if len(fotos) != 0 { + first := fotos[0] + tmp.Og_url = &first + } for _, url := range fotos { fmt.Println("Processing image", url) imgpath := filepath.Join(path, fmt.Sprintf("%d", nfoto)) diff --git a/apps/backend/models.go b/apps/backend/models.go index aa3bf79..883391d 100644 --- a/apps/backend/models.go +++ b/apps/backend/models.go @@ -259,6 +259,7 @@ type AnnuncioParsed struct { Url_foto *[]string Url_video *[]string Web *bool + Og_url *string } type AnnunciDB struct { @@ -310,6 +311,7 @@ type AnnunciDB struct { Email *string Creato_il *time.Time Modificato_il *time.Time + Og_url *string } type FilebrowserData struct {