mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 16:00:32 +00:00
implement scheduleNotification
This commit is contained in:
@@ -4,9 +4,27 @@ import { ServerContext } from "../ServerContext";
|
||||
export const MutationResolvers: Resolvers<ServerContext> = {
|
||||
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: "Not implemented",
|
||||
success: false
|
||||
message: "Notification scheduled",
|
||||
success: true,
|
||||
data: args.input,
|
||||
}
|
||||
return response;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user