add logic to send notification based on a provided threshold

This commit is contained in:
2025-03-25 15:19:09 -07:00
parent 1f8d4bfbd4
commit fb49577cf6
3 changed files with 37 additions and 28 deletions

View File

@@ -1,5 +1,9 @@
import { NotificationInput, NotificationResponse, Resolvers } from "../generated/graphql";
import { ServerContext } from "../ServerContext";
import {
ETANotificationScheduler,
NotificationSchedulingArguments
} from "../notifications/schedulers/ETANotificationScheduler";
export const MutationResolvers: Resolvers<ServerContext> = {
Mutation: {
@@ -19,7 +23,12 @@ export const MutationResolvers: Resolvers<ServerContext> = {
}
}
await context.notificationService.scheduleNotification(args.input);
const notificationData: NotificationSchedulingArguments = {
...args.input,
secondsThreshold: ETANotificationScheduler.defaultSecondsThresholdForNotificationToFire,
}
await context.notificationService.scheduleNotification(notificationData);
const response: NotificationResponse = {
message: "Notification scheduled",