mirror of
https://github.com/crocofied/CoreControl.git
synced 2025-12-21 09:26:52 +00:00
Add name field to AddRequest interface and update notification creation logic
This commit is contained in:
parent
70e28cb1c7
commit
807d4d6ca9
@ -3,6 +3,7 @@ import { prisma } from "@/lib/prisma";
|
|||||||
|
|
||||||
interface AddRequest {
|
interface AddRequest {
|
||||||
type: string;
|
type: string;
|
||||||
|
name: string;
|
||||||
smtpHost?: string;
|
smtpHost?: string;
|
||||||
smtpPort?: number;
|
smtpPort?: number;
|
||||||
smtpSecure?: boolean;
|
smtpSecure?: boolean;
|
||||||
@ -25,11 +26,12 @@ interface AddRequest {
|
|||||||
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, gotifyUrl, gotifyToken, ntfyUrl, ntfyToken, pushoverUrl, pushoverToken, pushoverUser } = body;
|
const { type, name, smtpHost, smtpPort, smtpSecure, smtpUsername, smtpPassword, smtpFrom, smtpTo, telegramToken, telegramChatId, discordWebhook, gotifyUrl, gotifyToken, ntfyUrl, ntfyToken, pushoverUrl, pushoverToken, pushoverUser } = body;
|
||||||
|
|
||||||
const notification = await prisma.notification.create({
|
const notification = await prisma.notification.create({
|
||||||
data: {
|
data: {
|
||||||
type: type,
|
type: type,
|
||||||
|
name: name,
|
||||||
smtpHost: smtpHost,
|
smtpHost: smtpHost,
|
||||||
smtpPort: smtpPort,
|
smtpPort: smtpPort,
|
||||||
smtpFrom: smtpFrom,
|
smtpFrom: smtpFrom,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user