Skip to content

Commit

Permalink
create channels for Hospital data
Browse files Browse the repository at this point in the history
  • Loading branch information
DutchmanNL committed Oct 26, 2021
1 parent 83487a7 commit 94dddec
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,14 @@ class Covid19 extends utils.Adapter {

try {
await this.writeHospitalDataForId(channelName, await HospitalService.getGermanHospitalDataByFederalState(germanHospitalData$, federalStateName));
// Create hospital channel for each Federal State
await this.extendObjectAsync(`${channelName}.Hospital`, {
type: 'channel',
common: {
name: `Hospital`,
},
native: {},
});
} catch (error) {
this.log.error(`Cannot write hospital data for ${channelName}: ${error}`);
}
Expand Down Expand Up @@ -885,6 +893,15 @@ class Covid19 extends utils.Adapter {
return;
}


await this.extendObjectAsync(`${id}.Hospital`, {
type: 'channel',
common: {
name: `Hospital`,
},
native: {},
});

for (const key of Object.keys(data)) {
await this.localCreateState(`${id}.Hospital.${key}`, key, data[key]);
}
Expand Down

0 comments on commit 94dddec

Please sign in to comment.