-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
32 lines (27 loc) · 930 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
const { fetchIosReviews } = require('./src/iosReviewBot');
const { fetchAndroidReviews } = require('./src/androidReviewBot');
const { getReviews } = require('./src/database');
const cron = require('node-cron');
startIos = async () => {
const iosIds = await getReviews("iOS");
let allIosIds = [];
iosIds.forEach(item => {
allIosIds.push(item.ids)
});
const mergedIosIds = [].concat.apply([], allIosIds);
fetchIosReviews("iOS Store Key", mergedIosIds, "iOS");
}
startAndroid = async () => {
const androidIds = await getReviews("Android");
let allAndroidIds = [];
androidIds.forEach(item => {
allAndroidIds.push(item.ids)
});
const mergedAndroidIds = [].concat.apply([], allAndroidIds);
fetchAndroidReviews("android.bundle.identifier", mergedAndroidIds, "Android");
}
// Twelve hours
cron.schedule("* * 12 * *", function() {
startAndroid();
startIos();
})