Fix: modified: src/app/api/mobile/notification/[id]/route.ts modified: src/app/api/mobile/notification/[id]/unread-count/route.ts modified: src/app/api/mobile/notification/route.ts ### No Issue
32 lines
639 B
TypeScript
32 lines
639 B
TypeScript
import { prisma } from "@/lib";
|
|
import { NextRequest, NextResponse } from "next/server";
|
|
|
|
export async function GET(
|
|
request: NextRequest,
|
|
{ params }: { params: { id: string } }
|
|
) {
|
|
const { id } = params;
|
|
console.log("User ID:", id);
|
|
|
|
try {
|
|
const data = await prisma.notifikasi.count({
|
|
where: {
|
|
recipientId: id,
|
|
isRead: false,
|
|
},
|
|
});
|
|
|
|
console.log("List Notification >>", data);
|
|
|
|
return NextResponse.json({
|
|
success: true,
|
|
data: data,
|
|
});
|
|
} catch (error) {
|
|
return NextResponse.json({
|
|
success: false,
|
|
message: "Failed to get unread count",
|
|
});
|
|
}
|
|
}
|