track when node position was last updated
This commit is contained in:
@ -0,0 +1,2 @@
|
|||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE `nodes` ADD COLUMN `position_updated_at` DATETIME(3) NULL;
|
@ -25,6 +25,7 @@ model Node {
|
|||||||
latitude Int?
|
latitude Int?
|
||||||
longitude Int?
|
longitude Int?
|
||||||
altitude Int?
|
altitude Int?
|
||||||
|
position_updated_at DateTime?
|
||||||
|
|
||||||
battery_level Int?
|
battery_level Int?
|
||||||
voltage Decimal?
|
voltage Decimal?
|
||||||
|
@ -174,6 +174,7 @@ client.on("message", async (topic, message) => {
|
|||||||
node_id: envelope.packet.from,
|
node_id: envelope.packet.from,
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
|
position_updated_at: new Date(),
|
||||||
latitude: position.latitudeI,
|
latitude: position.latitudeI,
|
||||||
longitude: position.longitudeI,
|
longitude: position.longitudeI,
|
||||||
altitude: position.altitude !== 0 ? position.altitude : null,
|
altitude: position.altitude !== 0 ? position.altitude : null,
|
||||||
|
Reference in New Issue
Block a user