SpaceAPI: sensors: radiation: required fields

This commit is contained in:
He4eT 2025-05-23 02:20:49 +02:00
commit e14842605a
3 changed files with 12 additions and 4 deletions

View file

@ -13,7 +13,8 @@
"attributes": {
"type": {
"type": "enumeration",
"enum": ["alpha", "beta", "gamma", "beta_gamma"]
"enum": ["alpha", "beta", "gamma", "beta_gamma"],
"required": true
},
"value": {
"type": "decimal",

View file

@ -67,6 +67,8 @@ export default ({ strapi }: { strapi: Core.Strapi }) => ({
result.logo = absoluteURL(origin)(hackspace?.logo.url);
result.url = hackspace.url;
/* */
if (!isEmpty(hackspace.location)) {
result.location = pickFields([
'address',
@ -84,12 +86,16 @@ export default ({ strapi }: { strapi: Core.Strapi }) => ({
}
}
/* */
if (!isEmpty(hackspace.spacefed)) {
result.spacefed = pickFields(['spacenet', 'spacesaml'])(
hackspace.spacefed,
);
}
/* */
if (!isEmpty(hackspace.cam)) {
result.cam = hackspace.cam.map(({ url }) => url);
}
@ -217,7 +223,7 @@ export default ({ strapi }: { strapi: Core.Strapi }) => ({
'api::radiation-sensor.radiation-sensor',
);
const draft = Object.fromEntries(
const typedSensors = Object.fromEntries(
types.map((type) => [
type,
sensors
@ -237,7 +243,7 @@ export default ({ strapi }: { strapi: Core.Strapi }) => ({
]),
);
return pickFields(types)(draft);
return pickFields(types)(typedSensors);
})(),
humidity: (
await getSensors('api::humidity-sensor.humidity-sensor', [