mirror of
https://github.com/He4eT/simple-spaceapi.git
synced 2026-05-05 01:47:24 +00:00
SpaceAPI: sensors: wind: messed types
This commit is contained in:
parent
e14842605a
commit
7c8fa7755d
1 changed files with 20 additions and 23 deletions
|
|
@ -175,7 +175,7 @@ export default ({ strapi }: { strapi: Core.Strapi }) => ({
|
||||||
const getSensorsRaw = (
|
const getSensorsRaw = (
|
||||||
query: UID.ContentType,
|
query: UID.ContentType,
|
||||||
populate = [],
|
populate = [],
|
||||||
): Promise<Object[]> =>
|
): Promise<Array<object>> =>
|
||||||
strapi
|
strapi
|
||||||
.documents(query)
|
.documents(query)
|
||||||
.findMany({ populate })
|
.findMany({ populate })
|
||||||
|
|
@ -278,16 +278,14 @@ export default ({ strapi }: { strapi: Core.Strapi }) => ({
|
||||||
'api::wind-sensor.wind-sensor',
|
'api::wind-sensor.wind-sensor',
|
||||||
['properties', 'location', 'name', 'description', 'lastchange'],
|
['properties', 'location', 'name', 'description', 'lastchange'],
|
||||||
[
|
[
|
||||||
|
'properties',
|
||||||
'properties.speed',
|
'properties.speed',
|
||||||
'properties.gust',
|
'properties.gust',
|
||||||
'properties.direction',
|
'properties.direction',
|
||||||
'properties.elevation',
|
'properties.elevation',
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
).map(
|
).map((sensor: { properties: Record<string, object> }) => {
|
||||||
(sensor: {
|
|
||||||
properties: { bits_per_second: number; packets_per_second: number };
|
|
||||||
}) => {
|
|
||||||
const { properties, ...rest } = sensor;
|
const { properties, ...rest } = sensor;
|
||||||
|
|
||||||
const propertiesEntries = Object.entries(
|
const propertiesEntries = Object.entries(
|
||||||
|
|
@ -306,8 +304,7 @@ export default ({ strapi }: { strapi: Core.Strapi }) => ({
|
||||||
? {}
|
? {}
|
||||||
: { properties: Object.fromEntries(propertiesEntries) }),
|
: { properties: Object.fromEntries(propertiesEntries) }),
|
||||||
};
|
};
|
||||||
},
|
}),
|
||||||
),
|
|
||||||
network_connections: (
|
network_connections: (
|
||||||
await getSensors(
|
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