-
Notifications
You must be signed in to change notification settings - Fork 0
/
inversify.config.ts
53 lines (49 loc) · 2.92 KB
/
inversify.config.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
52
53
import "reflect-metadata";
import { Container } from "inversify";
import { RaceRepository } from "./src/domain/repository/RaceRepository";
import { RaceRepositoryImpl } from "./src/data/repository/RaceRepositoryImpl";
import { ErgastApi } from "./src/data/network/api/ErgastApi";
import { GetLastRaceUseCase } from "./src/domain/usecase/GetLastRaceUseCase";
import { GetNextRaceUseCase } from "./src/domain/usecase/GetNextRaceUseCase";
import { SeasonRepositoryImpl } from "./src/data/repository/SeasonRepositoryImpl";
import { SeasonRepository } from "./src/domain/repository/SeasonRepository";
import { StandingsRepository } from "./src/domain/repository/StandingsRepository";
import { StandingsRepositoryImpl } from "./src/data/repository/StandingsResponseImpl";
import { GetSeasonPlanningUseCase } from "./src/domain/usecase/GetSeasonPlanningUseCase";
import { GetDriverStandingsUseCase } from "./src/domain/usecase/GetDriverStandingsUseCase";
import { GetConstructorStandingsUseCase } from "./src/domain/usecase/GetConstructorStandingsUseCase";
import { GetCircuitsUseCase } from "./src/domain/usecase/GetCircuitsUseCase";
import { GetRaceUseCase } from "./src/domain/usecase/GetRaceUseCase";
export const TYPES = {
// DATA SOURCE
ErgastApi: Symbol.for("ErgastApi"),
// REPOSITORY
RaceRepository: Symbol.for("RaceRepository"),
SeasonRepository: Symbol.for("SeasonRepository"),
StandingsRepository: Symbol.for("StandingsRepository"),
// USE CASE
GetLastRaceUseCase: Symbol.for("GetLastRaceUseCase"),
GetNextRaceUseCase: Symbol.for("GetNextRaceUseCase"),
GetSeasonPlanningUseCase: Symbol.for("GetSeasonPlanningUseCase"),
GetDriverStandingsUseCase: Symbol.for("GetDriverStandingsUseCase"),
GetConstructorStandingsUseCase: Symbol.for("GetConstructorStandingsUseCase"),
GetCircuitsUseCase: Symbol.for("GetCircuitsUseCase"),
GetRaceUseCase: Symbol.for("GetRaceUseCase"),
};
const container = new Container();
// API
container.bind<ErgastApi>(TYPES.ErgastApi).to(ErgastApi);
// REPOSITORY
container.bind<RaceRepository>(TYPES.RaceRepository).to(RaceRepositoryImpl);
container.bind<SeasonRepository>(TYPES.SeasonRepository).to(SeasonRepositoryImpl);
container.bind<StandingsRepository>(TYPES.StandingsRepository).to(StandingsRepositoryImpl);
// USE CASE
container.bind<GetLastRaceUseCase>(TYPES.GetLastRaceUseCase).to(GetLastRaceUseCase);
container.bind<GetNextRaceUseCase>(TYPES.GetNextRaceUseCase).to(GetNextRaceUseCase);
container.bind<GetSeasonPlanningUseCase>(TYPES.GetSeasonPlanningUseCase).to(GetSeasonPlanningUseCase);
container.bind<GetDriverStandingsUseCase>(TYPES.GetDriverStandingsUseCase).to(GetDriverStandingsUseCase);
container.bind<GetConstructorStandingsUseCase>(TYPES.GetConstructorStandingsUseCase).to(GetConstructorStandingsUseCase);
container.bind<GetCircuitsUseCase>(TYPES.GetCircuitsUseCase).to(GetCircuitsUseCase);
container.bind<GetRaceUseCase>(TYPES.GetRaceUseCase).to(GetRaceUseCase);
// Exporter le conteneur
export default container;