Desc:
- Fitur crowdfunding
- Fitur Investasi
- Fitur tambah investasi
No issue
This commit is contained in:
2023-10-20 10:15:17 +08:00
parent 66fcad8634
commit bff07e84b1
47 changed files with 1172 additions and 49 deletions

View File

@@ -0,0 +1,39 @@
import { NextRequest, NextResponse } from "next/server";
import fs from "fs";
import prisma from "@/app/lib/prisma";
export async function GET(
req: NextRequest,
{ params }: { params: { id: string } }
) {
console.log(params.id)
const data = await prisma.images.findUnique({
where: {
id: params.id,
},
select: {
url: true,
},
});
console.log(data)
// return data
if (!fs.existsSync(`./public/investasi/${data?.url}`)) {
const fl = fs.readFileSync(`./public/aset/no-img.png`);
return new NextResponse(fl, {
headers: {
"Content-Type": "image/png",
},
});
}
const fl = fs.readFileSync(`./public/investasi/${data?.url}`);
return new NextResponse(fl, {
headers: {
"Content-Type": "image/png",
},
});
}

View File

@@ -2,6 +2,9 @@ import prisma from "@/app/lib/prisma";
import { NextResponse } from "next/server";
import userRole from "../../../bin/seeder/user_role.json";
import bidangBisnis from "../../../bin/seeder/bidang_bisnis.json";
import pencarianInvestor from "./../../../bin/seeder/investasi/pencarian_investor.json";
import periodeDeviden from "./../../../bin/seeder/investasi/periode_deviden.json";
import pembagianDeviden from "./../../../bin/seeder/investasi/pembagian_deviden.json";
export async function GET(req: Request) {
const dev = new URL(req.url).searchParams.get("dev");
@@ -37,6 +40,55 @@ export async function GET(req: Request) {
},
});
}
for (let i of pencarianInvestor) {
await prisma.masterPencarianInvestor.upsert({
where: {
id: i.id.toString(),
},
update: {
id: i.id.toString(),
name: i.name,
},
create: {
id: i.id.toString(),
name: i.name,
},
});
}
for (let i of pembagianDeviden) {
await prisma.masterPembagianDeviden.upsert({
where: {
id: i.id.toString(),
},
update: {
id: i.id.toString(),
name: i.name,
},
create: {
id: i.id.toString(),
name: i.name,
},
});
}
for (let i of periodeDeviden) {
await prisma.masterPeriodeDeviden.upsert({
where: {
id: i.id.toString(),
},
update: {
id: i.id.toString(),
name: i.name,
},
create: {
id: i.id.toString(),
name: i.name,
},
});
}
return NextResponse.json({ success: true });
}