-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtask.js
More file actions
30 lines (29 loc) · 944 Bytes
/
task.js
File metadata and controls
30 lines (29 loc) · 944 Bytes
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
const { getLastSavedCommitTime, saveCommit } = require('./api/db');
const { sendTodayResult, sendYesterdayResult } = require('./api/kakaowork');
const { getUnsavedCommit } = require('./api/slack');
const { member_list_github } = require('./config/config');
switch (process.argv[2]) {
case 'today':
sendTodayResult();
break;
case 'yesterday':
sendYesterdayResult();
break;
case 'save':
(async () => {
const lastTime = await getLastSavedCommitTime().then((res) => res);
let unSavedCommit = await getUnsavedCommit(lastTime);
unSavedCommit = unSavedCommit.reverse();
unSavedCommit.map(async (e) => {
if (!member_list_github.includes(e['author_name'])) {
return;
}
await saveCommit({
username: e['author_name'],
commitLink: e['commit_link'],
timestamp: e['timestamp'],
});
});
console.log(new Date());
})();
}