import { NotificationInput, NotificationResponse, Resolvers } from "../generated/graphql"; import { ServerContext } from "../ServerContext"; export const MutationResolvers: Resolvers = { Mutation: { scheduleNotification: async (_parent, args, context, _info) => { const shuttle = await context.repository.getShuttleById(args.input.shuttleId); if (!shuttle) { return { message: "Shuttle ID doesn't exist", success: false, } } const stop = await context.repository.getStopById(args.input.stopId); if (!stop) { return { message: "Stop ID doesn't exist", success: false, } } await context.notificationService.scheduleNotification(args.input); const response: NotificationResponse = { message: "Notification scheduled", success: true, data: args.input, } return response; }, cancelNotification: async (_parent, args, context, _info) => { const response: NotificationResponse = { message: "Not implemented", success: false } return response; }, }, }