mirror of
https://github.com/He4eT/simple-spaceapi.git
synced 2026-05-04 17:37:24 +00:00
SpaceAPI: wind sensor
This commit is contained in:
parent
3323a3eb38
commit
ac9dcd9753
1 changed files with 29 additions and 3 deletions
|
|
@ -285,17 +285,43 @@ export default ({ strapi }: { strapi: Core.Strapi }) => ({
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
const windSensors = await getSensors(
|
const windSensors = (await getSensors(
|
||||||
'api::wind-sensor.wind-sensor',
|
'api::wind-sensor.wind-sensor',
|
||||||
[
|
[
|
||||||
'TODO',
|
|
||||||
'properties',
|
'properties',
|
||||||
'location',
|
'location',
|
||||||
'name',
|
'name',
|
||||||
'description',
|
'description',
|
||||||
'lastchange',
|
'lastchange',
|
||||||
],
|
],
|
||||||
);
|
[
|
||||||
|
'properties.speed',
|
||||||
|
'properties.gust',
|
||||||
|
'properties.direction',
|
||||||
|
'properties.elevation',
|
||||||
|
],
|
||||||
|
)).map((sensor: {properties: {bits_per_second: number, packets_per_second: number}}) => {
|
||||||
|
const { properties, ...rest } = sensor;
|
||||||
|
|
||||||
|
const propertiesEntries = Object.entries(pickFields([
|
||||||
|
'speed',
|
||||||
|
'gust',
|
||||||
|
'direction',
|
||||||
|
'elevation',
|
||||||
|
])(properties))
|
||||||
|
.map(([k, {value, unit}]) => [k, {
|
||||||
|
value,
|
||||||
|
unit: unit === 'Degree' ? '°' : unit,
|
||||||
|
}]);
|
||||||
|
|
||||||
|
return {
|
||||||
|
...rest,
|
||||||
|
...(isEmpty(propertiesEntries)
|
||||||
|
? {}
|
||||||
|
: { properties: Object.fromEntries(propertiesEntries) }
|
||||||
|
),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
const networkConnectionsSensors = (await getSensors(
|
const networkConnectionsSensors = (await getSensors(
|
||||||
'api::network-connections-sensor.network-connections-sensor',
|
'api::network-connections-sensor.network-connections-sensor',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue