mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
rename class to InterchangeSystem.ts and add builder arguments
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { System } from "./entities/System";
|
import { InterchangeSystem } from "./entities/InterchangeSystem";
|
||||||
|
|
||||||
export interface ServerContext {
|
export interface ServerContext {
|
||||||
systems: System[];
|
systems: InterchangeSystem[];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,12 @@ import { RedisNotificationRepository } from "../repositories/RedisNotificationRe
|
|||||||
import { NotificationRepository } from "../repositories/NotificationRepository";
|
import { NotificationRepository } from "../repositories/NotificationRepository";
|
||||||
import { ShuttleGetterSetterRepository } from "../repositories/ShuttleGetterSetterRepository";
|
import { ShuttleGetterSetterRepository } from "../repositories/ShuttleGetterSetterRepository";
|
||||||
|
|
||||||
export class System {
|
export interface InterchangeSystemBuilderArguments {
|
||||||
|
name: string;
|
||||||
|
passioSystemId: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class InterchangeSystem {
|
||||||
constructor(
|
constructor(
|
||||||
public systemId: string,
|
public systemId: string,
|
||||||
public shuttleDataLoader: ShuttleRepositoryLoader,
|
public shuttleDataLoader: ShuttleRepositoryLoader,
|
||||||
@@ -19,25 +24,24 @@ export class System {
|
|||||||
/**
|
/**
|
||||||
* Construct an instance of the class where all composited
|
* Construct an instance of the class where all composited
|
||||||
* classes are correctly linked.
|
* classes are correctly linked.
|
||||||
* @param systemId
|
* @param args
|
||||||
* @param notificationRepository
|
* @param notificationRepository
|
||||||
*/
|
*/
|
||||||
static build(
|
static build(
|
||||||
systemId: string,
|
args: InterchangeSystemBuilderArguments,
|
||||||
notificationRepository: NotificationRepository = new RedisNotificationRepository()
|
notificationRepository: NotificationRepository = new RedisNotificationRepository()
|
||||||
) {
|
) {
|
||||||
const shuttleRepository = new UnoptimizedInMemoryShuttleRepository();
|
const shuttleRepository = new UnoptimizedInMemoryShuttleRepository();
|
||||||
const shuttleDataLoader = new TimedApiBasedShuttleRepositoryLoader(systemId, shuttleRepository);
|
const shuttleDataLoader = new TimedApiBasedShuttleRepositoryLoader(args.passioSystemId, shuttleRepository);
|
||||||
|
|
||||||
const notificationScheduler = new ETANotificationScheduler(shuttleRepository, notificationRepository);
|
const notificationScheduler = new ETANotificationScheduler(shuttleRepository, notificationRepository);
|
||||||
|
|
||||||
const system = new System(
|
return new InterchangeSystem(
|
||||||
systemId,
|
args.name,
|
||||||
shuttleDataLoader,
|
shuttleDataLoader,
|
||||||
shuttleRepository,
|
shuttleRepository,
|
||||||
notificationScheduler,
|
notificationScheduler,
|
||||||
notificationRepository,
|
notificationRepository,
|
||||||
);
|
);
|
||||||
return system;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user