mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
add logic to send notification based on a provided threshold
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user