upd : investasi portofolio
Deskripsi: - api pada list investasi portofolio - semua status No Issues
This commit is contained in:
@@ -98,6 +98,38 @@ export async function GET(request: Request) {
|
||||
if (userLoginId == null) {
|
||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan data, user id tidak ada" }, { status: 500 });
|
||||
}
|
||||
|
||||
const data = await prisma.investasi.findMany({
|
||||
take: 5,
|
||||
skip: dataSkip,
|
||||
orderBy: {
|
||||
updatedAt: "desc",
|
||||
},
|
||||
where: {
|
||||
authorId: userLoginId,
|
||||
masterStatusInvestasiId: status,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
targetDana: true,
|
||||
imageId: true,
|
||||
countDown: true,
|
||||
updatedAt: true,
|
||||
MasterPencarianInvestor: {
|
||||
select: {
|
||||
name: true
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
dataFix = data.map((v: any) => ({
|
||||
..._.omit(v, ["MasterPencarianInvestor"]),
|
||||
pencarianInvestor: v.MasterPencarianInvestor.name
|
||||
}))
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,22 +1,23 @@
|
||||
import { investasi_funGetPortofolioByStatusId } from "@/app_modules/investasi/_fun";
|
||||
import { Investasi_UiPortofolio } from "@/app_modules/investasi/_ui";
|
||||
import { Investasi_UiPortofolio, Investasi_UiPortofolioNew } from "@/app_modules/investasi/_ui";
|
||||
import getStatusInvestasi from "@/app_modules/investasi/fun/master/get_status_investasi";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
const statusId = params.id;
|
||||
// const statusId = params.id;
|
||||
const listStatus = await getStatusInvestasi();
|
||||
const dataPortofolio = await investasi_funGetPortofolioByStatusId({
|
||||
page: 1,
|
||||
statusId: statusId,
|
||||
});
|
||||
// const dataPortofolio = await investasi_funGetPortofolioByStatusId({
|
||||
// page: 1,
|
||||
// statusId: statusId,
|
||||
// });
|
||||
|
||||
return (
|
||||
<>
|
||||
<Investasi_UiPortofolio
|
||||
{/* <Investasi_UiPortofolio
|
||||
statusId={statusId}
|
||||
listStatus={listStatus as any}
|
||||
dataPortofolio={dataPortofolio as any}
|
||||
/>
|
||||
/> */}
|
||||
<Investasi_UiPortofolioNew listStatus={listStatus as any} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user