@@ -2,13 +2,17 @@ import { CronJob } from 'cron';
2
2
3
3
import { config } from './config.js' ;
4
4
5
+ import { createServer } from './server.js' ;
5
6
import { ReservationController } from './src/application/ReservationController.js' ;
7
+ import { CreateReservationEventsUseCase } from './src/domain/usecases/CreateReservationEventsUseCase.js' ;
6
8
import { GetActiveReservationsUseCase } from './src/domain/usecases/GetActiveReservationsUseCase.js' ;
9
+ import { GetAllEventsUseCase } from './src/domain/usecases/GetAllEventsUseCase.js' ;
7
10
import { HandleNewReservationUseCase } from './src/domain/usecases/HandleNewReservationUseCase.js' ;
8
11
import { HandleScheduledReservationUseCase } from './src/domain/usecases/HandleScheduledReservationUseCase.js' ;
9
12
import { NotifyUseCase } from './src/domain/usecases/NotifyUseCase.js' ;
10
13
import { SubmitFormUseCase } from './src/domain/usecases/SubmitFormUseCase.js' ;
11
14
import { Browser } from './src/infrastructure/Browser.js' ;
15
+ import { CalendarRepository } from './src/infrastructure/CalendarRepository.js' ;
12
16
import { ImapClient } from './src/infrastructure/ImapClient.js' ;
13
17
import { logger } from './src/infrastructure/logger.js' ;
14
18
import { NotificationClient } from './src/infrastructure/NotificationClient.js' ;
@@ -31,6 +35,8 @@ async function main() {
31
35
start : true ,
32
36
timeZone : parisTimezone ,
33
37
} ) ;
38
+ const server = await createServer ( { reservationController } ) ;
39
+ await server . start ( ) ;
34
40
}
35
41
36
42
async function getReservationController ( ) {
@@ -71,12 +77,23 @@ async function getReservationController() {
71
77
reservationRepository,
72
78
} ) ;
73
79
80
+ const calendarRepository = new CalendarRepository ( config . calendar . name ) ;
81
+
82
+ const createReservationEventsUseCase = new CreateReservationEventsUseCase ( {
83
+ reservationRepository,
84
+ calendarRepository,
85
+ } ) ;
86
+
87
+ const getAllEventsUseCase = new GetAllEventsUseCase ( { calendarRepository } ) ;
88
+
74
89
return new ReservationController ( {
75
90
handleNewReservationUseCase,
76
91
getActiveReservationsUseCase,
77
92
submitFormUseCase,
78
93
notifyUseCase,
79
94
handleScheduledReservationUseCase,
95
+ createReservationEventsUseCase,
96
+ getAllEventsUseCase,
80
97
logger,
81
98
} ) ;
82
99
}
0 commit comments