Merge pull request #32 from brendan-ch/chore/split-notification-service

[INT-45] chore/split-notification-service
This commit is contained in:
2025-03-24 10:35:38 -07:00
committed by GitHub
9 changed files with 341 additions and 222 deletions

View File

@@ -5,9 +5,10 @@ import { MergedResolvers } from "./MergedResolvers";
import { ServerContext } from "./ServerContext";
import { UnoptimizedInMemoryRepository } from "./repositories/UnoptimizedInMemoryRepository";
import { TimedApiBasedRepositoryLoader } from "./loaders/TimedApiBasedRepositoryLoader";
import { NotificationService } from "./services/NotificationService";
import { ETANotificationScheduler } from "./notifications/schedulers/ETANotificationScheduler";
import { configDotenv } from "dotenv";
import { loadTestData } from "./loaders/loadTestData";
import { AppleNotificationSender } from "./notifications/senders/AppleNotificationSender";
configDotenv();
@@ -21,19 +22,19 @@ async function main() {
});
const repository = new UnoptimizedInMemoryRepository();
let notificationService: NotificationService;
let notificationService: ETANotificationScheduler;
if (process.argv.length > 2 && process.argv[2] == "integration-testing") {
console.log("Using integration testing setup")
await loadTestData(repository);
notificationService = new NotificationService(repository, false);
const appleNotificationSender = new AppleNotificationSender(false);
notificationService = new ETANotificationScheduler(repository, appleNotificationSender);
} else {
const repositoryDataUpdater = new TimedApiBasedRepositoryLoader(
repository
);
await repositoryDataUpdater.start();
notificationService = new NotificationService(repository);
notificationService = new ETANotificationScheduler(repository);
}
notificationService.reloadAPNsTokenIfTimePassed();
const { url } = await startStandaloneServer(server, {
listen: {