mirror of
https://github.com/He4eT/simple-spaceapi.git
synced 2026-05-05 01:47:24 +00:00
SpaceAPI: sensors: radiation: required fields
This commit is contained in:
parent
182fd4588e
commit
e14842605a
3 changed files with 12 additions and 4 deletions
|
|
@ -13,7 +13,8 @@
|
||||||
"attributes": {
|
"attributes": {
|
||||||
"type": {
|
"type": {
|
||||||
"type": "enumeration",
|
"type": "enumeration",
|
||||||
"enum": ["alpha", "beta", "gamma", "beta_gamma"]
|
"enum": ["alpha", "beta", "gamma", "beta_gamma"],
|
||||||
|
"required": true
|
||||||
},
|
},
|
||||||
"value": {
|
"value": {
|
||||||
"type": "decimal",
|
"type": "decimal",
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,8 @@ export default ({ strapi }: { strapi: Core.Strapi }) => ({
|
||||||
result.logo = absoluteURL(origin)(hackspace?.logo.url);
|
result.logo = absoluteURL(origin)(hackspace?.logo.url);
|
||||||
result.url = hackspace.url;
|
result.url = hackspace.url;
|
||||||
|
|
||||||
|
/* */
|
||||||
|
|
||||||
if (!isEmpty(hackspace.location)) {
|
if (!isEmpty(hackspace.location)) {
|
||||||
result.location = pickFields([
|
result.location = pickFields([
|
||||||
'address',
|
'address',
|
||||||
|
|
@ -84,12 +86,16 @@ export default ({ strapi }: { strapi: Core.Strapi }) => ({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* */
|
||||||
|
|
||||||
if (!isEmpty(hackspace.spacefed)) {
|
if (!isEmpty(hackspace.spacefed)) {
|
||||||
result.spacefed = pickFields(['spacenet', 'spacesaml'])(
|
result.spacefed = pickFields(['spacenet', 'spacesaml'])(
|
||||||
hackspace.spacefed,
|
hackspace.spacefed,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* */
|
||||||
|
|
||||||
if (!isEmpty(hackspace.cam)) {
|
if (!isEmpty(hackspace.cam)) {
|
||||||
result.cam = hackspace.cam.map(({ url }) => url);
|
result.cam = hackspace.cam.map(({ url }) => url);
|
||||||
}
|
}
|
||||||
|
|
@ -217,7 +223,7 @@ export default ({ strapi }: { strapi: Core.Strapi }) => ({
|
||||||
'api::radiation-sensor.radiation-sensor',
|
'api::radiation-sensor.radiation-sensor',
|
||||||
);
|
);
|
||||||
|
|
||||||
const draft = Object.fromEntries(
|
const typedSensors = Object.fromEntries(
|
||||||
types.map((type) => [
|
types.map((type) => [
|
||||||
type,
|
type,
|
||||||
sensors
|
sensors
|
||||||
|
|
@ -237,7 +243,7 @@ export default ({ strapi }: { strapi: Core.Strapi }) => ({
|
||||||
]),
|
]),
|
||||||
);
|
);
|
||||||
|
|
||||||
return pickFields(types)(draft);
|
return pickFields(types)(typedSensors);
|
||||||
})(),
|
})(),
|
||||||
humidity: (
|
humidity: (
|
||||||
await getSensors('api::humidity-sensor.humidity-sensor', [
|
await getSensors('api::humidity-sensor.humidity-sensor', [
|
||||||
|
|
|
||||||
3
types/generated/contentTypes.d.ts
vendored
3
types/generated/contentTypes.d.ts
vendored
|
|
@ -852,7 +852,8 @@ export interface ApiRadiationSensorRadiationSensor
|
||||||
publishedAt: Schema.Attribute.DateTime;
|
publishedAt: Schema.Attribute.DateTime;
|
||||||
type: Schema.Attribute.Enumeration<
|
type: Schema.Attribute.Enumeration<
|
||||||
['alpha', 'beta', 'gamma', 'beta_gamma']
|
['alpha', 'beta', 'gamma', 'beta_gamma']
|
||||||
>;
|
> &
|
||||||
|
Schema.Attribute.Required;
|
||||||
unit: Schema.Attribute.Enumeration<
|
unit: Schema.Attribute.Enumeration<
|
||||||
['cpm', 'r/h', '\u00B5Sv/h', 'mSv/a', '\u00B5Sv/a']
|
['cpm', 'r/h', '\u00B5Sv/h', 'mSv/a', '\u00B5Sv/a']
|
||||||
> &
|
> &
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue