Add Gotify and ntfy fields to AddRequest interface and update POST method to handle new notification types

This commit is contained in:
headlessdev 2025-04-19 13:11:18 +02:00
parent 93bffa29cc
commit 300547e59e

View File

@ -13,12 +13,16 @@ interface AddRequest {
telegramToken?: string; telegramToken?: string;
telegramChatId?: string; telegramChatId?: string;
discordWebhook?: string; discordWebhook?: string;
gotifyUrl?: string;
gotifyToken?: string;
ntfyUrl?: string;
ntfyToken?: string;
} }
export async function POST(request: NextRequest) { export async function POST(request: NextRequest) {
try { try {
const body: AddRequest = await request.json(); const body: AddRequest = await request.json();
const { type, smtpHost, smtpPort, smtpSecure, smtpUsername, smtpPassword, smtpFrom, smtpTo, telegramToken, telegramChatId, discordWebhook } = body; const { type, smtpHost, smtpPort, smtpSecure, smtpUsername, smtpPassword, smtpFrom, smtpTo, telegramToken, telegramChatId, discordWebhook, gotifyUrl, gotifyToken, ntfyUrl, ntfyToken } = body;
const notification = await prisma.notification.create({ const notification = await prisma.notification.create({
data: { data: {
@ -33,6 +37,10 @@ export async function POST(request: NextRequest) {
telegramChatId: telegramChatId, telegramChatId: telegramChatId,
telegramToken: telegramToken, telegramToken: telegramToken,
discordWebhook: discordWebhook, discordWebhook: discordWebhook,
gotifyUrl: gotifyUrl,
gotifyToken: gotifyToken,
ntfyUrl: ntfyUrl,
ntfyToken: ntfyToken,
} }
}); });