mirror of
https://github.com/He4eT/simple-spaceapi.git
synced 2026-05-04 17:37: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": {
|
||||
"type": {
|
||||
"type": "enumeration",
|
||||
"enum": ["alpha", "beta", "gamma", "beta_gamma"]
|
||||
"enum": ["alpha", "beta", "gamma", "beta_gamma"],
|
||||
"required": true
|
||||
},
|
||||
"value": {
|
||||
"type": "decimal",
|
||||
|
|
|
|||
|
|
@ -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', [
|
||||
|
|
|
|||
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;
|
||||
type: Schema.Attribute.Enumeration<
|
||||
['alpha', 'beta', 'gamma', 'beta_gamma']
|
||||
>;
|
||||
> &
|
||||
Schema.Attribute.Required;
|
||||
unit: Schema.Attribute.Enumeration<
|
||||
['cpm', 'r/h', '\u00B5Sv/h', 'mSv/a', '\u00B5Sv/a']
|
||||
> &
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue