-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmain.ts
51 lines (47 loc) · 1.28 KB
/
main.ts
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { parse } from "ts-command-line-args";
import { Config } from "./Config";
import { NextChooser, DoneWatcher, IconFetcher } from "./controller";
import { NotionRepository } from "./repository/NotionRepository";
import {
FetchAssigneeUserIconUseCase,
GetAllPagesAndGroupByUseCase,
UpdatePropertiesUseCase,
} from "./useCases";
const { KEY, DATABASE_ID } = Config.Notion;
const main = async () => {
const args = parse<Config.CLI_ARGS>({
mode: String,
});
const notionRepo = new NotionRepository({
KEY,
DATABASE_ID,
});
switch (args.mode) {
case Config.Mode.CHOOSE_NEXT: {
const handler = await new NextChooser(
new GetAllPagesAndGroupByUseCase(notionRepo),
new UpdatePropertiesUseCase(notionRepo)
).run();
console.log({ handler });
break;
}
case Config.Mode.WATCH_DONE: {
const handler = await new DoneWatcher(
new GetAllPagesAndGroupByUseCase(notionRepo),
new UpdatePropertiesUseCase(notionRepo)
).run();
console.log({ handler });
break;
}
case Config.Mode.FETCH_ICON: {
const handler = await new IconFetcher(
new FetchAssigneeUserIconUseCase(notionRepo)
).run();
console.log({ handler });
break;
}
default:
break;
}
};
main();