API Mobile

Add:
- src/app/api/mobile/investment/[id]/investor/

Fix:
modified:   src/app/api/mobile/admin/investment/[id]/invoice/route.ts
modified:   src/app/api/mobile/admin/investment/[id]/route.ts
modified:   src/app/api/mobile/investment/[id]/invoice/route.ts
modified:   src/app/api/mobile/investment/[id]/route.ts
modified:   src/app/api/mobile/investment/route.ts

#### No Issue
This commit is contained in:
2025-11-03 17:53:58 +08:00
parent 5e07dfb749
commit 9a967f0965
6 changed files with 161 additions and 76 deletions

View File

@@ -0,0 +1,48 @@
import { NextResponse } from "next/server";
import prisma from "@/lib/prisma";
export { GET };
async function GET(request: Request, { params }: { params: { id: string } }) {
const { id } = params;
try {
const data = await prisma.investasi_Invoice.findMany({
where: {
investasiId: id,
statusInvoiceId: "1",
},
select: {
id: true,
nominal: true,
Author: {
select: {
id: true,
username: true,
Profile: {
select: {
id: true,
name: true,
imageId: true,
},
},
},
},
},
});
return NextResponse.json({
status: 200,
success: true,
message: "Berhasil Mendapatkan Data",
data: data,
});
} catch (error) {
return NextResponse.json({
status: 500,
success: false,
message: "Error Mendapatkan Data",
reason: (error as Error).message,
});
}
}

View File

@@ -48,6 +48,9 @@ async function GET(request: Request, { params }: { params: { id: string } }) {
const category = searchParams.get("category");
const authorId = searchParams.get("authorId");
console.log("[ID INVOICE]", id);
let fixData;
try {
@@ -80,6 +83,8 @@ async function GET(request: Request, { params }: { params: { id: string } }) {
},
});
console.log("[DATA INVOICE]", data ? true : false);
const { ...allData } = data;
const Investor = data?.Investasi?.Investasi_Invoice;
fixData = { ...allData, Investor };

View File

@@ -17,7 +17,11 @@ async function GET(request: Request, { params }: { params: { id: string } }) {
Profile: true,
},
},
Investasi_Invoice: true,
Investasi_Invoice: {
where: {
statusInvoiceId: "1"
}
},
MasterStatusInvestasi: true,
BeritaInvestasi: true,
DokumenInvestasi: true,