Desc:
- Penambahan seeder bidang bisnis
This commit is contained in:
2023-10-05 13:54:27 +08:00
parent ad86f37c7b
commit 2506482586
2 changed files with 37 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
import prisma from "@/app/lib/prisma";
import userRole from "../../../bin/seeder/user_role.json";
import { NextResponse } from "next/server";
import userRole from "../../../bin/seeder/user_role.json";
import bidangBisnis from "../../../bin/seeder/bidang_bisnis.json";
export async function GET(req: Request) {
const dev = new URL(req.url).searchParams.get("dev");
@@ -20,8 +21,24 @@ export async function GET(req: Request) {
},
});
}
for (let i of bidangBisnis) {
await prisma.masterBidangBisnis.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 });
}
return NextResponse.json({ success: false });
}
}

View File

@@ -0,0 +1,18 @@
[
{
"id": 1,
"name": "Software Developer"
},
{
"id": 2,
"name": "Makanan & Minuman"
},
{
"id": 3,
"name": "Kosmetik"
},
{
"id": 4,
"name": "Mesin Mobil"
}
]