mirror of
https://github.com/crocofied/CoreControl.git
synced 2025-12-17 15:36:50 +00:00
Test notification api route
This commit is contained in:
parent
825b25a60b
commit
b2c47a07a6
23
app/api/notifications/test/route.ts
Normal file
23
app/api/notifications/test/route.ts
Normal file
@ -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 });
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user