mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
add a build method and export statement
This commit is contained in:
@@ -1,11 +1,34 @@
|
|||||||
import { ShuttleGetterSetterRepository } from "../repositories/ShuttleGetterSetterRepository";
|
|
||||||
import { ShuttleRepositoryLoader } from "../loaders/ShuttleRepositoryLoader";
|
import { ShuttleRepositoryLoader } from "../loaders/ShuttleRepositoryLoader";
|
||||||
|
import { ETANotificationScheduler } from "../notifications/schedulers/ETANotificationScheduler";
|
||||||
|
import { TimedApiBasedShuttleRepositoryLoader } from "../loaders/TimedApiBasedShuttleRepositoryLoader";
|
||||||
|
import { UnoptimizedInMemoryShuttleRepository } from "../repositories/UnoptimizedInMemoryShuttleRepository";
|
||||||
|
import { RedisNotificationRepository } from "../repositories/RedisNotificationRepository";
|
||||||
|
|
||||||
class System {
|
export class System {
|
||||||
constructor(
|
constructor(
|
||||||
public systemId: string,
|
public systemId: string,
|
||||||
public shuttleRepository: ShuttleGetterSetterRepository,
|
|
||||||
public shuttleDataLoader: ShuttleRepositoryLoader,
|
public shuttleDataLoader: ShuttleRepositoryLoader,
|
||||||
|
public notificationScheduler: ETANotificationScheduler,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct an instance of the class where all composited
|
||||||
|
* classes are correctly linked.
|
||||||
|
* @param systemId
|
||||||
|
*/
|
||||||
|
static build(systemId: string) {
|
||||||
|
const shuttleRepository = new UnoptimizedInMemoryShuttleRepository();
|
||||||
|
const shuttleDataLoader = new TimedApiBasedShuttleRepositoryLoader(systemId, shuttleRepository);
|
||||||
|
|
||||||
|
const notificationRepository = new RedisNotificationRepository();
|
||||||
|
const notificationScheduler = new ETANotificationScheduler(shuttleRepository, notificationRepository);
|
||||||
|
|
||||||
|
const system = new System(
|
||||||
|
systemId,
|
||||||
|
shuttleDataLoader,
|
||||||
|
notificationScheduler,
|
||||||
|
);
|
||||||
|
return system;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user