Skip to content

Commit aa75b99

Browse files
authored
fix(server): fix gcs migration for tile_type (#110)
1 parent 7ef1891 commit aa75b99

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

server/internal/infrastructure/mongo/migration/251201173239_gcschange_esri_to_default.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,18 +179,28 @@ func storiesModify(ctx context.Context, c DBClient, gateway gateway.File) error
179179

180180
func change(data map[string]interface{}) bool {
181181
modified := false
182+
183+
targets := map[string]bool{
184+
"esri_world_topo": true,
185+
"stamen_watercolor": true,
186+
"stamen_toner": true,
187+
}
188+
182189
if property, ok := data["property"].(map[string]interface{}); ok {
183190
if tiles, ok := property["tiles"].([]interface{}); ok {
184191
for _, tile := range tiles {
185192
if tileMap, ok := tile.(map[string]interface{}); ok {
186-
if tileType, ok := tileMap["tile_type"].(string); ok && tileType == "esri_world_topo" {
187-
tileMap["tile_type"] = "default"
188-
modified = true
193+
if tileType, ok := tileMap["tile_type"].(string); ok {
194+
if targets[tileType] {
195+
tileMap["tile_type"] = "default"
196+
modified = true
197+
}
189198
}
190199
}
191200
}
192201
}
193202
}
203+
194204
return modified
195205
}
196206

0 commit comments

Comments
 (0)