forked from zepatrik/munich-corona-occupancies
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
36 lines (34 loc) · 887 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const writeOccupancy = require('./src/writeToFolder')
const {
boulderwelt,
swm,
einstein,
dav,
heavensgate
} = require('./src/fetchers/index')
const swmMapping = require('./src/helpers/swm_mapping')
// run fetcher
async function run() {
await Promise.all([
boulderwelt().then((data) =>
Promise.all(data.map(({ bwId, ...rest }) => writeOccupancy(rest, bwId)))
),
einstein().then((data) => writeOccupancy(data, 'b_ei')),
swm().then((data) =>
Promise.all(
data.map(({ swmId, ...rest }) =>
writeOccupancy(rest, swmMapping[swmId].short)
)
)
),
dav().then((data) =>
Promise.all(data.map(({ davId, ...rest }) => writeOccupancy(rest, davId)))
),
heavensgate().then((data) =>
Promise.all(
data.map(({ heavensId, ...rest }) => writeOccupancy(rest, heavensId))
)
)
])
}
run()