horrible
This commit is contained in:
@ -93,19 +93,36 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dataTypes := make([]DataType, 0)
|
dataTypes := make([]DataType, 0)
|
||||||
|
|
||||||
|
// lord
|
||||||
|
// forgive me
|
||||||
|
idMap := make(map[uuid.UUID]bool)
|
||||||
|
|
||||||
for _, image := range images {
|
for _, image := range images {
|
||||||
for _, location := range image.Locations {
|
for _, location := range image.Locations {
|
||||||
|
_, exists := idMap[location.ID]
|
||||||
|
if exists {
|
||||||
|
continue
|
||||||
|
}
|
||||||
dataTypes = append(dataTypes, DataType{
|
dataTypes = append(dataTypes, DataType{
|
||||||
Type: "location",
|
Type: "location",
|
||||||
Data: location,
|
Data: location,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
idMap[location.ID] = true
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, event := range image.Events {
|
for _, event := range image.Events {
|
||||||
|
_, exists := idMap[event.ID]
|
||||||
|
if exists {
|
||||||
|
continue
|
||||||
|
}
|
||||||
dataTypes = append(dataTypes, DataType{
|
dataTypes = append(dataTypes, DataType{
|
||||||
Type: "event",
|
Type: "event",
|
||||||
Data: event,
|
Data: event,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
idMap[event.ID] = true
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, note := range image.Notes {
|
for _, note := range image.Notes {
|
||||||
@ -113,13 +130,20 @@ func main() {
|
|||||||
Type: "note",
|
Type: "note",
|
||||||
Data: note,
|
Data: note,
|
||||||
})
|
})
|
||||||
|
idMap[note.ID] = true
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, contact := range image.Contacts {
|
for _, contact := range image.Contacts {
|
||||||
|
_, exists := idMap[contact.ID]
|
||||||
|
if exists {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
dataTypes = append(dataTypes, DataType{
|
dataTypes = append(dataTypes, DataType{
|
||||||
Type: "contact",
|
Type: "contact",
|
||||||
Data: contact,
|
Data: contact,
|
||||||
})
|
})
|
||||||
|
idMap[contact.ID] = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user