From c98367f12ead9b84b9ecc21bd03e5bfc1b1286f2 Mon Sep 17 00:00:00 2001 From: Brendan Chen Date: Mon, 31 Mar 2025 19:35:38 -0700 Subject: [PATCH] add bindings and redis client arg for constructor --- .../RedisNotificationRepository.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/repositories/RedisNotificationRepository.ts b/src/repositories/RedisNotificationRepository.ts index ad31307..8480877 100644 --- a/src/repositories/RedisNotificationRepository.ts +++ b/src/repositories/RedisNotificationRepository.ts @@ -4,10 +4,24 @@ import { NotificationRepository, ScheduledNotification } from "./NotificationRepository"; +import { createClient, RedisClientType } from "redis"; class RedisNotificationRepository implements NotificationRepository { - addOrUpdateNotification(notification: ScheduledNotification): Promise { - return Promise.resolve(undefined); + constructor( + private redisClient = createClient({ + url: process.env.REDIS_URL, + }), + ) { + this.getAllNotificationsForShuttleAndStopId = this.getAllNotificationsForShuttleAndStopId.bind(this); + this.getSecondsThresholdForNotificationIfExists = this.getSecondsThresholdForNotificationIfExists.bind(this); + this.deleteNotificationIfExists = this.deleteNotificationIfExists.bind(this); + this.addOrUpdateNotification = this.addOrUpdateNotification.bind(this); + this.isNotificationScheduled = this.isNotificationScheduled.bind(this); + this.subscribeToNotificationChanges = this.subscribeToNotificationChanges.bind(this); + this.unsubscribeFromNotificationChanges = this.unsubscribeFromNotificationChanges.bind(this); + } + + public async addOrUpdateNotification(notification: ScheduledNotification): Promise { } public async deleteNotificationIfExists(lookupArguments: NotificationLookupArguments): Promise {