fix api klist investor

This commit is contained in:
2025-03-05 10:24:12 +08:00
parent f669b11a24
commit 70f85525dd
15 changed files with 252 additions and 58 deletions

View File

@@ -0,0 +1,49 @@
import { prisma } from "@/lib";
import { NextResponse } from "next/server";
export const dynamic = "force-dynamic";
// GET ONE DATA INVESTASI BY ID
export async function GET(
request: Request,
context: { params: { id: string } }
) {
try {
const { id } = context.params;
const data = await prisma.investasi.findUnique({
where: {
id: id,
},
include: {
author: {
include: {
Profile: true,
},
},
Investasi_Invoice: true,
MasterStatusInvestasi: true,
BeritaInvestasi: true,
DokumenInvestasi: true,
ProspektusInvestasi: true,
MasterPembagianDeviden: true,
MasterPencarianInvestor: true,
MasterPeriodeDeviden: true,
MasterProgresInvestasi: true,
},
});
return NextResponse.json(
{ success: true, message: "Berhasil mendapatkan data", data },
{ status: 200 }
);
} catch (error) {
console.error(error);
return NextResponse.json(
{
success: false,
message: "Gagal mendapatkan data, coba lagi nanti ",
reason: (error as Error).message,
},
{ status: 500 }
);
}
}