fix method calls and tests

This commit is contained in:
2025-03-27 10:56:57 -07:00
parent a665c29745
commit ef94a9aa7e
4 changed files with 17 additions and 16 deletions

View File

@@ -30,7 +30,7 @@ export const MutationResolvers: Resolvers<ServerContext> = {
: ETANotificationScheduler.defaultSecondsThresholdForNotificationToFire,
}
await context.notificationRepository.scheduleNotification(notificationData);
await context.notificationRepository.addOrUpdateNotification(notificationData);
const response: NotificationResponse = {
message: "Notification scheduled",
@@ -40,8 +40,9 @@ export const MutationResolvers: Resolvers<ServerContext> = {
return response;
},
cancelNotification: async (_parent, args, context, _info) => {
if (context.notificationRepository.isNotificationScheduled(args.input)) {
await context.notificationRepository.cancelNotificationIfExists(args.input);
const isScheduled = await context.notificationRepository.isNotificationScheduled(args.input)
if (isScheduled) {
await context.notificationRepository.deleteNotificationIfExists(args.input);
return {
success: true,
message: "Notification cancelled",

View File

@@ -18,11 +18,11 @@ export const QueryResolvers: Resolvers<ServerContext> = {
},
isNotificationScheduled: async (_parent, args, contextValue, _info) => {
const notificationData = args.input;
return contextValue.notificationRepository.isNotificationScheduled(notificationData);
return await contextValue.notificationRepository.isNotificationScheduled(notificationData);
},
secondsThresholdForNotification: async (_parent, args, contextValue, _info) => {
const notificationData = args.input;
return contextValue.notificationRepository.getSecondsThresholdForScheduledNotification(notificationData);
return await contextValue.notificationRepository.getSecondsThresholdForNotificationIfExists(notificationData);
},
},
}