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 {