feat
Desc: - Fitur crowdfunding - Fitur Investasi - Fitur tambah investasi No issue
This commit is contained in:
39
src/app/api/investasi/gambar/[id]/route.ts
Normal file
39
src/app/api/investasi/gambar/[id]/route.ts
Normal 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",
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -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 });
|
||||
}
|
||||
|
||||
|
||||
14
src/app/dev/crowd/main/layout.tsx
Normal file
14
src/app/dev/crowd/main/layout.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
import { LayoutMainCrowd } from "@/app_modules/crowd";
|
||||
import React from "react";
|
||||
|
||||
export default async function Layout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<LayoutMainCrowd>{children}</LayoutMainCrowd>
|
||||
</>
|
||||
);
|
||||
}
|
||||
9
src/app/dev/crowd/main/page.tsx
Normal file
9
src/app/dev/crowd/main/page.tsx
Normal file
@@ -0,0 +1,9 @@
|
||||
import { MainCrowd } from "@/app_modules/crowd";
|
||||
|
||||
export default async function Page() {
|
||||
return (
|
||||
<>
|
||||
<MainCrowd />
|
||||
</>
|
||||
);
|
||||
}
|
||||
7
src/app/dev/crowd/splash/page.tsx
Normal file
7
src/app/dev/crowd/splash/page.tsx
Normal file
@@ -0,0 +1,7 @@
|
||||
import { SplashCrowd } from "@/app_modules/crowd";
|
||||
|
||||
export default async function Page() {
|
||||
return <>
|
||||
<SplashCrowd/>
|
||||
</>
|
||||
}
|
||||
14
src/app/dev/investasi/create/layout.tsx
Normal file
14
src/app/dev/investasi/create/layout.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
import { InvestasiCreateLayout } from "@/app_modules/investasi";
|
||||
import React from "react";
|
||||
|
||||
export default async function Layout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<InvestasiCreateLayout>{children}</InvestasiCreateLayout>
|
||||
</>
|
||||
);
|
||||
}
|
||||
37
src/app/dev/investasi/create/page.tsx
Normal file
37
src/app/dev/investasi/create/page.tsx
Normal file
@@ -0,0 +1,37 @@
|
||||
import { InvestasiCreate } from "@/app_modules/investasi";
|
||||
import { unsealData } from "iron-session";
|
||||
import { cookies } from "next/headers";
|
||||
import yaml from "yaml";
|
||||
import fs from "fs";
|
||||
import { funCreateInvestasi } from "@/app_modules/investasi/fun/fun_create_investasi";
|
||||
import getPencarianInvestor from "@/app_modules/investasi/fun/get_pencarian_investor";
|
||||
import getPeriodeDeviden from "@/app_modules/investasi/fun/get_periode_deviden";
|
||||
import getPembagianDeviden from "@/app_modules/investasi/fun/get_pembagian_deviden";
|
||||
|
||||
const config = yaml.parse(fs.readFileSync("config.yaml").toString());
|
||||
|
||||
export default async function Page() {
|
||||
const c = cookies().get("ssn");
|
||||
const tkn = JSON.parse(
|
||||
await unsealData(c?.value as string, {
|
||||
password: config.server.password,
|
||||
})
|
||||
);
|
||||
|
||||
const pencarianInvestor = await getPencarianInvestor();
|
||||
const periodeDeviden = await getPeriodeDeviden();
|
||||
const pembagianDeviden = await getPembagianDeviden();
|
||||
|
||||
// console.log(pembagianDeviden)
|
||||
|
||||
return (
|
||||
<>
|
||||
<InvestasiCreate
|
||||
id={tkn.id}
|
||||
pencarianInvestor={pencarianInvestor as any}
|
||||
periodeDeviden={periodeDeviden as any}
|
||||
pembagianDeviden={pembagianDeviden as any}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
8
src/app/dev/investasi/main/layout.tsx
Normal file
8
src/app/dev/investasi/main/layout.tsx
Normal file
@@ -0,0 +1,8 @@
|
||||
import { LayoutMainInvestasi } from "@/app_modules/investasi";
|
||||
import React from "react";
|
||||
|
||||
export default async function Layout({children}: {children: React.ReactNode}) {
|
||||
return <>
|
||||
<LayoutMainInvestasi>{children}</LayoutMainInvestasi>
|
||||
</>
|
||||
}
|
||||
24
src/app/dev/investasi/main/page.tsx
Normal file
24
src/app/dev/investasi/main/page.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
import { MainInvestasi } from "@/app_modules/investasi";
|
||||
import { getListAllInvestasi } from "@/app_modules/investasi/fun/get_list_all_investasi";
|
||||
import getPembagianDeviden from "@/app_modules/investasi/fun/get_pembagian_deviden";
|
||||
import getPencarianInvestor from "@/app_modules/investasi/fun/get_pencarian_investor";
|
||||
import getPeriodeDeviden from "@/app_modules/investasi/fun/get_periode_deviden";
|
||||
|
||||
export default async function Page() {
|
||||
const data = await getListAllInvestasi()
|
||||
const pencarianInvestor = await getPencarianInvestor();
|
||||
const periodeDeviden = await getPeriodeDeviden();
|
||||
const pembagianDeviden = await getPembagianDeviden();
|
||||
|
||||
// console.log(data)
|
||||
return <>
|
||||
<MainInvestasi
|
||||
listData={data as any}
|
||||
pencarianInvestor={pencarianInvestor as any}
|
||||
periodeDeviden={periodeDeviden as any}
|
||||
pembagianDeviden={pembagianDeviden as any}
|
||||
|
||||
/>
|
||||
</>
|
||||
|
||||
}
|
||||
8
src/app/dev/investasi/upload/layout.tsx
Normal file
8
src/app/dev/investasi/upload/layout.tsx
Normal file
@@ -0,0 +1,8 @@
|
||||
import { LayoutUploadGambarInvestasi } from "@/app_modules/investasi";
|
||||
import React from "react";
|
||||
|
||||
export default async function Layout({children}: {children: React.ReactNode}) {
|
||||
return<>
|
||||
<LayoutUploadGambarInvestasi>{children}</LayoutUploadGambarInvestasi>
|
||||
</>
|
||||
}
|
||||
7
src/app/dev/investasi/upload/page.tsx
Normal file
7
src/app/dev/investasi/upload/page.tsx
Normal file
@@ -0,0 +1,7 @@
|
||||
import { UploadGambarInvestasi } from "@/app_modules/investasi";
|
||||
|
||||
export default async function Page() {
|
||||
return<>
|
||||
<UploadGambarInvestasi/>
|
||||
</>
|
||||
}
|
||||
@@ -14,4 +14,7 @@ export const ApiHipmi = {
|
||||
|
||||
//Portofolio
|
||||
create_portofolio: "/api/portofolio/create",
|
||||
|
||||
//Investasi
|
||||
get_gambar_investasi: "/api/investasi/gambar"
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user