API Mobile:
Fix: - api/mobile/portofolio/route.ts - api/mobile/portofolio/[id]/route.ts ### No issue
This commit is contained in:
@@ -11,14 +11,49 @@ async function GET(request: Request, { params }: { params: { id: string } }) {
|
|||||||
where: {
|
where: {
|
||||||
id: id,
|
id: id,
|
||||||
},
|
},
|
||||||
include: {
|
select: {
|
||||||
|
id: true,
|
||||||
|
id_Portofolio: true,
|
||||||
|
namaBisnis: true,
|
||||||
|
alamatKantor: true,
|
||||||
|
tlpn: true,
|
||||||
|
deskripsi: true,
|
||||||
|
logoId: true,
|
||||||
|
masterBidangBisnisId: true,
|
||||||
Profile: {
|
Profile: {
|
||||||
include: {
|
select: {
|
||||||
User: true,
|
userId: true,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
MasterBidangBisnis: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
name: true,
|
||||||
|
active: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Portofolio_MediaSosial: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
facebook: true,
|
||||||
|
instagram: true,
|
||||||
|
tiktok: true,
|
||||||
|
twitter: true,
|
||||||
|
youtube: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Portofolio_BidangDanSubBidangBisnis: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
MasterSubBidangBisnis: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
name: true,
|
||||||
|
masterBidangBisnisId: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
MasterBidangBisnis: true,
|
|
||||||
Portofolio_MediaSosial: true,
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -51,6 +51,8 @@ async function POST(request: Request) {
|
|||||||
try {
|
try {
|
||||||
const { data } = await request.json();
|
const { data } = await request.json();
|
||||||
|
|
||||||
|
console.log("DATA >>", data);
|
||||||
|
|
||||||
const createPortofolio = await prisma.portofolio.create({
|
const createPortofolio = await prisma.portofolio.create({
|
||||||
data: {
|
data: {
|
||||||
profileId: data.id,
|
profileId: data.id,
|
||||||
@@ -64,37 +66,37 @@ async function POST(request: Request) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// if (data.subBidang.length > 0 || data.subBidang.map((item: any) => item.id !== "")) {
|
if (data.subBidang.length > 0 || data.subBidang.map((item: any) => item.id !== "")) {
|
||||||
// for (let i of data.subBidang) {
|
for (let i of data.subBidang) {
|
||||||
// const createSubBidang =
|
const createSubBidang =
|
||||||
// await prisma.portofolio_BidangDanSubBidangBisnis.create({
|
await prisma.portofolio_BidangDanSubBidangBisnis.create({
|
||||||
// data: {
|
data: {
|
||||||
// portofolioId: createPortofolio.id,
|
portofolioId: createPortofolio.id,
|
||||||
// masterBidangBisnisId: data.masterBidangBisnisId,
|
masterBidangBisnisId: data.masterBidangBisnisId,
|
||||||
// masterSubBidangBisnisId: i.id,
|
masterSubBidangBisnisId: i.id,
|
||||||
// },
|
},
|
||||||
// });
|
});
|
||||||
|
|
||||||
// console.log("CREATE SUB BIDANG >>", createSubBidang);
|
console.log("CREATE SUB BIDANG >>", createSubBidang);
|
||||||
// if (!createSubBidang)
|
if (!createSubBidang)
|
||||||
// return NextResponse.json(
|
return NextResponse.json(
|
||||||
// {
|
{
|
||||||
// success: false,
|
success: false,
|
||||||
// message: "Gagal membuat sub bidang bisnis",
|
message: "Gagal membuat sub bidang bisnis",
|
||||||
// },
|
},
|
||||||
// { status: 400 }
|
{ status: 400 }
|
||||||
// );
|
);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if (!createPortofolio)
|
if (!createPortofolio)
|
||||||
// return NextResponse.json(
|
return NextResponse.json(
|
||||||
// {
|
{
|
||||||
// success: false,
|
success: false,
|
||||||
// message: "Gagal membuat portofolio",
|
message: "Gagal membuat portofolio",
|
||||||
// },
|
},
|
||||||
// { status: 400 }
|
{ status: 400 }
|
||||||
// );
|
);
|
||||||
|
|
||||||
const createMedsos = await prisma.portofolio_MediaSosial.create({
|
const createMedsos = await prisma.portofolio_MediaSosial.create({
|
||||||
data: {
|
data: {
|
||||||
|
|||||||
Reference in New Issue
Block a user