75 lines
2.5 KiB
JavaScript
75 lines
2.5 KiB
JavaScript
// Gibt für eine Property-Anfrage immer den 140er Sensor zurück
|
|
// rxf 2022-05-25
|
|
|
|
export const readProperties = async (query, limit = 0) => {
|
|
let ret = {error: false}
|
|
if ("sid" in query) { // if sid is given, read property for sid
|
|
ret.values = {
|
|
"_id" : 140,
|
|
"location_id" : 65,
|
|
"name" : "SDS011",
|
|
"since" : "2021-04-21T09:44:12.888Z",
|
|
"location" : [
|
|
{
|
|
"loc" :
|
|
{
|
|
"type" : "Point",
|
|
"coordinates" : [ 9.16, 48.778 ]
|
|
},
|
|
"id" : 65,
|
|
"altitude" : 282,
|
|
"since" : "2021-04-21T09:44:12.888Z",
|
|
"address" : { },
|
|
"exact_loc" : 0,
|
|
"indoor" : 0
|
|
}
|
|
]
|
|
}
|
|
} else { // otherwise read props corresponding to query
|
|
ret.values = [
|
|
{
|
|
"_id" : 140,
|
|
"location_id" : 65,
|
|
"name" : "SDS011",
|
|
"since" : "2021-04-21T09:44:12.888Z",
|
|
"location" : [
|
|
{
|
|
"loc" :
|
|
{
|
|
"type" : "Point",
|
|
"coordinates" : [ 9.16, 48.778 ]
|
|
},
|
|
"id" : 65,
|
|
"altitude" : 282,
|
|
"since" : "2021-04-21T09:44:12.888Z",
|
|
"address" : { },
|
|
"exact_loc" : 0,
|
|
"indoor" : 0
|
|
}
|
|
]
|
|
},{
|
|
"_id" : 141,
|
|
"location_id" : 65,
|
|
"name" : "BME280",
|
|
"since" : "2021-04-21T09:44:12.888Z",
|
|
"location" : [
|
|
{
|
|
"loc" :
|
|
{
|
|
"type" : "Point",
|
|
"coordinates" : [ 9.16, 48.778 ]
|
|
},
|
|
"id" : 65,
|
|
"altitude" : 282,
|
|
"since" : "2021-04-21T09:44:12.888Z",
|
|
"address" : { },
|
|
"exact_loc" : 0,
|
|
"indoor" : 0
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
return ret
|
|
}
|