diff --git a/src/lib/notifications/channelTypes.js b/src/lib/notifications/channelTypes.js deleted file mode 100644 index 766048e9c1aae7d3791e927407ae54b5e68d08f5..0000000000000000000000000000000000000000 --- a/src/lib/notifications/channelTypes.js +++ /dev/null @@ -1,13 +0,0 @@ -import { handleWebhook } from "../server/notifications/webhookHandler"; -import { handleEmail } from "../server/notifications/emailHandler"; - -/** - * @type {{ - * WEBHOOK: import("./types").ChannelType<?>, - * EMAIL: import("./types").ChannelType<?> - * }} - */ -export const ChannelType = { - WEBHOOK: {key: 1<<0, handler: handleWebhook}, - EMAIL: {key: 1<<1, handler: handleEmail}, -}; diff --git a/src/lib/server/notifications/channelTypes.js b/src/lib/server/notifications/channelTypes.js new file mode 100644 index 0000000000000000000000000000000000000000..90df94fb79db659ecbae1d614f1a75bf531d13d2 --- /dev/null +++ b/src/lib/server/notifications/channelTypes.js @@ -0,0 +1,13 @@ +import { handleWebhook } from "./webhookHandler"; +import { handleEmail } from "./emailHandler"; + +/** + * @type {{ + * WEBHOOK: import("../../notifications/types").ChannelType<?>, + * EMAIL: import("../../notifications/types").ChannelType<?> + * }} + */ +export const ChannelType = { + WEBHOOK: {key: 1<<0, handler: handleWebhook}, + EMAIL: {key: 1<<1, handler: handleEmail}, +}; diff --git a/src/lib/server/notifications/handler.ts b/src/lib/server/notifications/handler.ts index 0ca34a4828657d3b136c98a2e4e4e54d0109a5c9..07c83377effd06c19295f606c19f0f1e6126e163 100644 --- a/src/lib/server/notifications/handler.ts +++ b/src/lib/server/notifications/handler.ts @@ -1,5 +1,5 @@ import { db } from "$lib/server/database"; -import { ChannelType } from "../../notifications/channelTypes"; +import { ChannelType } from "./channelTypes"; import type { HandlerReturnType, NotificationChannel, NotificationData, NotificationType, PossibleNotificationType } from "../../notifications/types"; export async function sendNotification<T extends PossibleNotificationType>(user: { id: number, notificationChannels: NotificationChannel[] | undefined } | number, type: NotificationType<T>, data: NotificationData<T>): Promise<HandlerReturnType[]>{ diff --git a/src/routes/admin/user/[id]/+page.server.js b/src/routes/admin/user/[id]/+page.server.js index 654a367ab723e65dbdae77c58b1828871129ca54..6d438b444db42a4cf98e3b852e199d8bd5c022ac 100644 --- a/src/routes/admin/user/[id]/+page.server.js +++ b/src/routes/admin/user/[id]/+page.server.js @@ -1,7 +1,7 @@ import { addUserCard, getUser, updateCard } from "../../api/users"; import { fail } from "@sveltejs/kit"; import { createTransaction } from "../../api/transactions"; -import { ChannelType } from "$lib/notifications/channelTypes"; +import { ChannelType } from "$lib/server/notifications/channelTypes"; import { createNotificationChannel, updateNotificationChannel } from "../../api/notificationChannels"; export const load = async ({ params }) => {