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; }, }, }