From d3c824be68063fd60844f73b44af8a96efd735bb Mon Sep 17 00:00:00 2001 From: Brendan Chen Date: Tue, 4 Feb 2025 11:42:02 -0800 Subject: [PATCH] implement cancelNotification --- src/resolvers/MutationResolvers.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/resolvers/MutationResolvers.ts b/src/resolvers/MutationResolvers.ts index 18cb3d2..c1a4ce3 100644 --- a/src/resolvers/MutationResolvers.ts +++ b/src/resolvers/MutationResolvers.ts @@ -29,11 +29,19 @@ export const MutationResolvers: Resolvers = { return response; }, cancelNotification: async (_parent, args, context, _info) => { - const response: NotificationResponse = { - message: "Not implemented", - success: false + if (context.notificationService.isNotificationScheduled(args.input)) { + await context.notificationService.cancelNotificationIfExists(args.input); + return { + success: true, + message: "Notification cancelled", + data: args.input, + } + } + + return { + success: false, + message: "Notification doesn't exist" } - return response; }, }, }