upd: edit investasi
Deskripsi: - api master pada edit investasu No Issues
This commit is contained in:
39
src/app/api/new/investasi/[id]/route.ts
Normal file
39
src/app/api/new/investasi/[id]/route.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { prisma } from "@/app/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,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
targetDana: true,
|
||||
hargaLembar: true,
|
||||
totalLembar: true,
|
||||
roi: true,
|
||||
countDown: true,
|
||||
catatan: true,
|
||||
sisaLembar: true,
|
||||
imageId: true,
|
||||
masterPencarianInvestorId: true,
|
||||
masterPeriodeDevidenId: true,
|
||||
masterPembagianDevidenId: 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 });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user