implement scheduleNotification

This commit is contained in:
2025-02-04 11:40:09 -08:00
parent fa40d15f5a
commit 2b0bef876c

View File

@@ -4,9 +4,27 @@ import { ServerContext } from "../ServerContext";
export const MutationResolvers: Resolvers<ServerContext> = { export const MutationResolvers: Resolvers<ServerContext> = {
Mutation: { Mutation: {
scheduleNotification: async (_parent, args, context, _info) => { 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 = { const response: NotificationResponse = {
message: "Not implemented", message: "Notification scheduled",
success: false success: true,
data: args.input,
} }
return response; return response;
}, },