From b2c47a07a625bdaf41b51540903210bf3e06736c Mon Sep 17 00:00:00 2001 From: headlessdev Date: Wed, 23 Apr 2025 21:06:17 +0200 Subject: [PATCH] Test notification api route --- app/api/notifications/test/route.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 app/api/notifications/test/route.ts diff --git a/app/api/notifications/test/route.ts b/app/api/notifications/test/route.ts new file mode 100644 index 0000000..200a5c6 --- /dev/null +++ b/app/api/notifications/test/route.ts @@ -0,0 +1,23 @@ +import { NextResponse, NextRequest } from "next/server"; +import { prisma } from "@/lib/prisma"; + +interface AddRequest { + notificationId: number; +} + +export async function POST(request: NextRequest) { + try { + const body: AddRequest = await request.json(); + const { notificationId } = body; + + const notification = await prisma.test_notification.create({ + data: { + notificationId: notificationId, + } + }); + + return NextResponse.json({ message: "Success", notification }); + } catch (error: any) { + return NextResponse.json({ error: error.message }, { status: 500 }); + } +}