for development and production, swap out in memory repo for redis one

This commit is contained in:
2025-03-31 20:37:53 -07:00
parent fbc08838df
commit 0e204af330

View File

@@ -10,6 +10,7 @@ import { loadShuttleTestData } from "./loaders/loadShuttleTestData";
import { AppleNotificationSender } from "./notifications/senders/AppleNotificationSender";
import { InMemoryNotificationRepository } from "./repositories/InMemoryNotificationRepository";
import { NotificationRepository } from "./repositories/NotificationRepository";
import { RedisNotificationRepository } from "./repositories/RedisNotificationRepository";
const typeDefs = readFileSync("./schema.graphqls", "utf8");
@@ -24,6 +25,7 @@ async function main() {
let notificationRepository: NotificationRepository;
let notificationService: ETANotificationScheduler;
if (process.argv.length > 2 && process.argv[2] == "integration-testing") {
console.log("Using integration testing setup")
await loadShuttleTestData(shuttleRepository);
@@ -43,7 +45,10 @@ async function main() {
);
await repositoryDataUpdater.start();
notificationRepository = new InMemoryNotificationRepository();
const redisNotificationRepository = new RedisNotificationRepository();
await redisNotificationRepository.connect();
notificationRepository = redisNotificationRepository;
notificationService = new ETANotificationScheduler(
shuttleRepository,
notificationRepository