- app.config.js - app/(application)/(user)/forum/[id]/edit.tsx - app/(application)/(user)/forum/[id]/index.tsx - app/(application)/(user)/forum/create.tsx - ios/HIPMIBadungConnect/Info.plist ### No Issue
59 lines
1.2 KiB
TypeScript
59 lines
1.2 KiB
TypeScript
import { NextResponse } from "next/server";
|
|
import prisma from "@/lib/prisma";
|
|
|
|
export { GET };
|
|
|
|
async function GET(request: Request, { params }: { params: { id: string } }) {
|
|
try {
|
|
const { id } = params;
|
|
|
|
const data = await prisma.event_Peserta.findMany({
|
|
where: {
|
|
eventId: id,
|
|
},
|
|
select: {
|
|
eventId: true,
|
|
userId: true,
|
|
isPresent: true,
|
|
User: {
|
|
select: {
|
|
id: true,
|
|
username: true,
|
|
nomor: true,
|
|
Profile: {
|
|
select: {
|
|
id: true,
|
|
name: true,
|
|
imageId: true,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
Event: {
|
|
select: {
|
|
tanggal: true,
|
|
},
|
|
},
|
|
},
|
|
});
|
|
|
|
return NextResponse.json(
|
|
{
|
|
success: true,
|
|
message: "Success get participants",
|
|
data: data,
|
|
},
|
|
{ status: 200 }
|
|
);
|
|
} catch (error) {
|
|
return NextResponse.json(
|
|
{
|
|
success: false,
|
|
message: "Error get participants",
|
|
reason: (error as Error).message,
|
|
},
|
|
{ status: 500 }
|
|
);
|
|
}
|
|
}
|