From 7acd0f36db32e9e3023fe2a3b32094dc7caef955 Mon Sep 17 00:00:00 2001 From: liamcottle Date: Sun, 31 Mar 2024 23:59:55 +1300 Subject: [PATCH] collect extra map report data --- .../migration.sql | 7 +++++++ prisma/schema.prisma | 7 +++++++ src/mqtt.js | 6 ++++++ 3 files changed, 20 insertions(+) create mode 100644 prisma/migrations/20240331105735_add_extra_map_report_columns_to_nodes_table/migration.sql diff --git a/prisma/migrations/20240331105735_add_extra_map_report_columns_to_nodes_table/migration.sql b/prisma/migrations/20240331105735_add_extra_map_report_columns_to_nodes_table/migration.sql new file mode 100644 index 0000000..bb2bfa5 --- /dev/null +++ b/prisma/migrations/20240331105735_add_extra_map_report_columns_to_nodes_table/migration.sql @@ -0,0 +1,7 @@ +-- AlterTable +ALTER TABLE `nodes` ADD COLUMN `firmware_version` VARCHAR(191) NULL, + ADD COLUMN `has_default_channel` BOOLEAN NULL, + ADD COLUMN `modem_preset` INTEGER NULL, + ADD COLUMN `num_online_local_nodes` INTEGER NULL, + ADD COLUMN `position_precision` INTEGER NULL, + ADD COLUMN `region` INTEGER NULL; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 5dd8a41..6fcaa8e 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -22,6 +22,13 @@ model Node { role Int is_licensed Boolean? + firmware_version String? + region Int? + modem_preset Int? + has_default_channel Boolean? + position_precision Int? + num_online_local_nodes Int? + latitude Int? longitude Int? altitude Int? diff --git a/src/mqtt.js b/src/mqtt.js index 792178a..0c552ec 100644 --- a/src/mqtt.js +++ b/src/mqtt.js @@ -630,6 +630,12 @@ client.on("message", async (topic, message) => { latitude: mapReport.latitudeI, longitude: mapReport.longitudeI, altitude: mapReport.altitude !== 0 ? mapReport.altitude : null, + firmware_version: mapReport.firmwareVersion, + region: mapReport.region, + modem_preset: mapReport.modemPreset, + has_default_channel: mapReport.hasDefaultChannel, + position_precision: mapReport.positionPrecision, + num_online_local_nodes: mapReport.numOnlineLocalNodes, }; await prisma.node.upsert({