mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
update timed loader to use class composition
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { ShuttleRepositoryLoader } from "../loaders/ShuttleRepositoryLoader";
|
||||
import { ETANotificationScheduler } from "../notifications/schedulers/ETANotificationScheduler";
|
||||
import { TimedApiBasedShuttleRepositoryLoader } from "../loaders/TimedApiBasedShuttleRepositoryLoader";
|
||||
import { TimedApiBasedRepositoryLoader } from "../loaders/TimedApiBasedRepositoryLoader";
|
||||
import { UnoptimizedInMemoryShuttleRepository } from "../repositories/UnoptimizedInMemoryShuttleRepository";
|
||||
import { RedisNotificationRepository } from "../repositories/RedisNotificationRepository";
|
||||
import { NotificationRepository } from "../repositories/NotificationRepository";
|
||||
@@ -27,7 +26,7 @@ export class InterchangeSystem {
|
||||
constructor(
|
||||
public name: string,
|
||||
public id: string,
|
||||
public shuttleDataLoader: ShuttleRepositoryLoader,
|
||||
public shuttleTimedDataLoader: TimedApiBasedRepositoryLoader,
|
||||
public shuttleRepository: ShuttleGetterSetterRepository,
|
||||
public notificationScheduler: ETANotificationScheduler,
|
||||
public notificationRepository: NotificationRepository,
|
||||
@@ -43,12 +42,15 @@ export class InterchangeSystem {
|
||||
args: InterchangeSystemBuilderArguments,
|
||||
) {
|
||||
const shuttleRepository = new UnoptimizedInMemoryShuttleRepository();
|
||||
const shuttleDataLoader = new TimedApiBasedShuttleRepositoryLoader(
|
||||
const shuttleDataLoader = new ApiBasedShuttleRepositoryLoader(
|
||||
args.passioSystemId,
|
||||
args.id,
|
||||
shuttleRepository
|
||||
);
|
||||
await shuttleDataLoader.start();
|
||||
const timedShuttleDataLoader = new TimedApiBasedRepositoryLoader(
|
||||
shuttleDataLoader,
|
||||
);
|
||||
await timedShuttleDataLoader.start();
|
||||
|
||||
const notificationRepository = new RedisNotificationRepository();
|
||||
await notificationRepository.connect();
|
||||
@@ -62,7 +64,7 @@ export class InterchangeSystem {
|
||||
return new InterchangeSystem(
|
||||
args.name,
|
||||
args.id,
|
||||
shuttleDataLoader,
|
||||
timedShuttleDataLoader,
|
||||
shuttleRepository,
|
||||
notificationScheduler,
|
||||
notificationRepository,
|
||||
@@ -84,6 +86,11 @@ export class InterchangeSystem {
|
||||
args.id,
|
||||
shuttleRepository
|
||||
);
|
||||
// Note that this loader should not be started,
|
||||
// so the test data doesn't get overwritten
|
||||
const timedShuttleLoader = new TimedApiBasedRepositoryLoader(
|
||||
shuttleDataLoader,
|
||||
);
|
||||
|
||||
const notificationRepository = new InMemoryNotificationRepository();
|
||||
const notificationScheduler = new ETANotificationScheduler(
|
||||
@@ -96,7 +103,7 @@ export class InterchangeSystem {
|
||||
return new InterchangeSystem(
|
||||
args.name,
|
||||
args.id,
|
||||
shuttleDataLoader,
|
||||
timedShuttleLoader,
|
||||
shuttleRepository,
|
||||
notificationScheduler,
|
||||
notificationRepository,
|
||||
|
||||
Reference in New Issue
Block a user