-
Notifications
You must be signed in to change notification settings - Fork 1
/
production.ts
26 lines (22 loc) · 1.69 KB
/
production.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
import { Database } from "@/providers/Database";
import { ConsoleLogger } from "@/utils";
import { Lifecycle, container } from "tsyringe";
import { BikerRepositoryI, BikerService, BikerRepositoryMongoDB } from "@/services/biker";
import { CustomerRepositoryI, CustomerService, CustomerRepositoryMongoDB } from "@/services/customer";
import { BaseDatabase, BaseLogger } from "@/interfaces";
import { ShipmentRepositoryMongoDB, ShipmentService } from "@/services/shipment";
import { TOKENS } from "./Tokens";
export default function regesterDependencies() {
// Common Dependencies
container.register<BaseLogger>(TOKENS.logger, { useClass: ConsoleLogger }, { lifecycle: Lifecycle.Singleton });
container.register<BaseDatabase>(TOKENS.database, { useClass: Database }, { lifecycle: Lifecycle.Singleton });
// Biker dependencies
container.register<BikerService>(TOKENS.bikerService, { useClass: BikerService }, { lifecycle: Lifecycle.Singleton });
container.register<BikerRepositoryI>(TOKENS.bikerRepository, { useClass: BikerRepositoryMongoDB }, { lifecycle: Lifecycle.Singleton });
// Customer dependencies
container.register<CustomerService>(TOKENS.customerService, { useClass: CustomerService }, { lifecycle: Lifecycle.Singleton });
container.register<CustomerRepositoryI>(TOKENS.customerRepository, { useClass: CustomerRepositoryMongoDB }, { lifecycle: Lifecycle.Singleton });
// Shipment dependencies
container.register<ShipmentService>(TOKENS.shipmentService, { useClass: ShipmentService }, { lifecycle: Lifecycle.Singleton });
container.register<ShipmentRepositoryMongoDB>(TOKENS.shipmentRepository, { useClass: ShipmentRepositoryMongoDB }, { lifecycle: Lifecycle.Singleton });
}