mirror of
https://github.com/He4eT/simple-spaceapi.git
synced 2026-05-05 01:47:24 +00:00
Sensors: Humidity: units
This commit is contained in:
parent
2f0b886926
commit
b72e9214d5
4 changed files with 4 additions and 5 deletions
|
|
@ -127,7 +127,7 @@ Always validate your endpoint using the
|
||||||
Due to some Strapi limitations,
|
Due to some Strapi limitations,
|
||||||
certain sensor units must be replaced with aliases in API requests:
|
certain sensor units must be replaced with aliases in API requests:
|
||||||
|
|
||||||
- Humidity Sensor: use `percents` instead of `%`
|
- Humidity Sensor: use `percent` instead of `%`
|
||||||
- Wind Sensor: use `degree` instead of `°`
|
- Wind Sensor: use `degree` instead of `°`
|
||||||
|
|
||||||
The main SpaceAPI endpoint will display the correct units.
|
The main SpaceAPI endpoint will display the correct units.
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
},
|
},
|
||||||
"unit": {
|
"unit": {
|
||||||
"type": "enumeration",
|
"type": "enumeration",
|
||||||
"enum": ["percents"],
|
"enum": ["percent"],
|
||||||
"required": true
|
"required": true
|
||||||
},
|
},
|
||||||
"location": {
|
"location": {
|
||||||
|
|
|
||||||
|
|
@ -290,7 +290,7 @@ export default ({ strapi }: { strapi: Core.Strapi }) => ({
|
||||||
const { unit, ...rest } = sensor;
|
const { unit, ...rest } = sensor;
|
||||||
return {
|
return {
|
||||||
...rest,
|
...rest,
|
||||||
unit: unit === 'percents' ? '%' : unit,
|
unit: unit === 'percent' ? '%' : unit,
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
beverage_supply: await getSensors(
|
beverage_supply: await getSensors(
|
||||||
|
|
|
||||||
3
types/generated/contentTypes.d.ts
vendored
3
types/generated/contentTypes.d.ts
vendored
|
|
@ -639,8 +639,7 @@ export interface ApiHumiditySensorHumiditySensor
|
||||||
location: Schema.Attribute.String & Schema.Attribute.Required;
|
location: Schema.Attribute.String & Schema.Attribute.Required;
|
||||||
name: Schema.Attribute.String;
|
name: Schema.Attribute.String;
|
||||||
publishedAt: Schema.Attribute.DateTime;
|
publishedAt: Schema.Attribute.DateTime;
|
||||||
unit: Schema.Attribute.Enumeration<['percents']> &
|
unit: Schema.Attribute.Enumeration<['percent']> & Schema.Attribute.Required;
|
||||||
Schema.Attribute.Required;
|
|
||||||
updatedAt: Schema.Attribute.DateTime;
|
updatedAt: Schema.Attribute.DateTime;
|
||||||
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
|
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
|
||||||
Schema.Attribute.Private;
|
Schema.Attribute.Private;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue