set wifi timestamp
This commit is contained in:
parent
5e4fd59148
commit
93f0c71a6c
@ -56,9 +56,14 @@ router.post(
|
||||
timestamp: latitudeData?.timestamp
|
||||
? new Date(latitudeData.timestamp)
|
||||
: longitudeData?.timestamp
|
||||
? new Date(longitudeData.timestamp)
|
||||
: undefined,
|
||||
? new Date(longitudeData.timestamp)
|
||||
: undefined,
|
||||
};
|
||||
const wifiTimestamp = (() => {
|
||||
const messages = message.uplink_message.decoded_payload?.messages?.[0];
|
||||
const wifiScan = messages?.find((e: { type: string }) => e.type === "Wi-Fi Scan");
|
||||
return wifiScan?.timestamp ? new Date(wifiScan.timestamp) : undefined;
|
||||
})();
|
||||
|
||||
const wifiScans =
|
||||
message.uplink_message.decoded_payload?.messages[0]
|
||||
@ -67,6 +72,7 @@ router.post(
|
||||
lp_ttn_end_device_uplinks_id,
|
||||
mac: w.mac,
|
||||
rssi: w.rssi,
|
||||
scanned_at_timestamp: wifiTimestamp,
|
||||
})) ?? [];
|
||||
|
||||
const ttnGatewayReceptions = message.uplink_message.rx_metadata.map(
|
||||
@ -103,9 +109,9 @@ router.post(
|
||||
gnss:
|
||||
gnnsLocation.latitude && gnnsLocation.longitude
|
||||
? {
|
||||
latitude: gnnsLocation.latitude,
|
||||
longitude: gnnsLocation.longitude,
|
||||
}
|
||||
latitude: gnnsLocation.latitude,
|
||||
longitude: gnnsLocation.longitude,
|
||||
}
|
||||
: undefined,
|
||||
gnss_timestamp: gnssTimestamp.timestamp,
|
||||
});
|
||||
|
@ -5,12 +5,14 @@ interface CreateWifiScanParams {
|
||||
lp_ttn_end_device_uplinks_id: string;
|
||||
mac: string;
|
||||
rssi: number;
|
||||
scanned_at_timestamp?: Date;
|
||||
}
|
||||
|
||||
interface UpdateWifiScanParams {
|
||||
wifi_scan_id: string;
|
||||
mac?: string;
|
||||
rssi?: number;
|
||||
scanned_at_timestamp?: Date;
|
||||
}
|
||||
|
||||
@injectable()
|
||||
|
Loading…
Reference in New Issue
Block a user