From 55aa1e67babf2a67a42a3b9ddcaf05dff868d035 Mon Sep 17 00:00:00 2001 From: John Costa Date: Mon, 14 Apr 2025 10:30:21 +0100 Subject: [PATCH] horrible --- backend/main.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/backend/main.go b/backend/main.go index 63d9c07..9ab0731 100644 --- a/backend/main.go +++ b/backend/main.go @@ -93,19 +93,36 @@ func main() { } dataTypes := make([]DataType, 0) + + // lord + // forgive me + idMap := make(map[uuid.UUID]bool) + for _, image := range images { for _, location := range image.Locations { + _, exists := idMap[location.ID] + if exists { + continue + } dataTypes = append(dataTypes, DataType{ Type: "location", Data: location, }) + + idMap[location.ID] = true } for _, event := range image.Events { + _, exists := idMap[event.ID] + if exists { + continue + } dataTypes = append(dataTypes, DataType{ Type: "event", Data: event, }) + + idMap[event.ID] = true } for _, note := range image.Notes { @@ -113,13 +130,20 @@ func main() { Type: "note", Data: note, }) + idMap[note.ID] = true } for _, contact := range image.Contacts { + _, exists := idMap[contact.ID] + if exists { + continue + } + dataTypes = append(dataTypes, DataType{ Type: "contact", Data: contact, }) + idMap[contact.ID] = true } }