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 = (
|
||||
query: UID.ContentType,
|
||||
populate = [],
|
||||
): Promise<Object[]> =>
|
||||
): Promise<Array<object>> =>
|
||||
strapi
|
||||
.documents(query)
|
||||
.findMany({ populate })
|
||||
|
|
@ -278,16 +278,14 @@ export default ({ strapi }: { strapi: Core.Strapi }) => ({
|
|||
'api::wind-sensor.wind-sensor',
|
||||
['properties', 'location', 'name', 'description', 'lastchange'],
|
||||
[
|
||||
'properties',
|
||||
'properties.speed',
|
||||
'properties.gust',
|
||||
'properties.direction',
|
||||
'properties.elevation',
|
||||
],
|
||||
)
|
||||
).map(
|
||||
(sensor: {
|
||||
properties: { bits_per_second: number; packets_per_second: number };
|
||||
}) => {
|
||||
).map((sensor: { properties: Record<string, object> }) => {
|
||||
const { properties, ...rest } = sensor;
|
||||
|
||||
const propertiesEntries = Object.entries(
|
||||
|
|
@ -306,8 +304,7 @@ export default ({ strapi }: { strapi: Core.Strapi }) => ({
|
|||
? {}
|
||||
: { properties: Object.fromEntries(propertiesEntries) }),
|
||||
};
|
||||
},
|
||||
),
|
||||
}),
|
||||
network_connections: (
|
||||
await getSensors(
|
||||
'api::network-connections-sensor.network-connections-sensor',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue