API Mobile

Add:
- app/api/mobile/portofolio : find many & find uniqe
This commit is contained in:
2025-08-29 17:33:42 +08:00
parent ab8c0109fe
commit 8a4950c03a
2 changed files with 189 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
import { NextResponse } from "next/server";
import { prisma } from "@/lib";
export { GET };
async function GET(request: Request, { params }: { params: { id: string } }) {
try {
const { id } = params;
const data = await prisma.portofolio.findUnique({
where: {
id: id,
},
include: {
Profile: {
include: {
User: true,
},
},
MasterBidangBisnis: true,
Portofolio_MediaSosial: true,
},
});
if (!data)
return NextResponse.json(
{
success: false,
message: "Data tidak ditemukan",
},
{ status: 404 }
);
return NextResponse.json(
{
success: true,
message: "Berhasil mendapatkan data",
data: data,
},
{ status: 200 }
);
} catch (error) {
return NextResponse.json(
{
success: false,
message: "API Error Get Data Potofolio",
reason: (error as Error).message,
},
{ status: 500 }
);
}
}