WIP: D3 importer

This commit is contained in:
Michał Zieliński
2025-04-29 16:46:03 +02:00
parent bf8d86111c
commit dd150f3c39
9 changed files with 82 additions and 13 deletions

View File

@@ -40,13 +40,13 @@ public class MorskaD3Importer(
throw new Exception($"DataInbox not found, {type}");
}
var data = Convert.FromBase64String(dataInbox.Data);
var tst = Encoding.UTF8.GetString(data);
var records = JsonSerializer.Deserialize<List<Record>>(Encoding.UTF8.GetString(data));
if (records == null)
{
throw new Exception($"DataInbox.Data is empty, {dataInbox.Name}");
}
year = "2024";
records = records.Where(x => x.Code!.EndsWith($"{year}{month}")).ToList();
records = records.Where(x => x.Code!.StartsWith($"{year}{month}")).ToList();
if (records.Count == 0)
{
throw new Exception($"No records found for {year}{month}");
@@ -72,6 +72,6 @@ public class MorskaD3Importer(
db.Layers.Add(layer);
controller.SaveRecords(layer.Id, records, Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"));
//db.SaveChanges();
db.SaveChanges();
}
}