mcp pengaduan
Deskripsi: - database pengaduan - seeder pengaduan No Issues
This commit is contained in:
@@ -1,24 +1,51 @@
|
||||
import { prisma } from "@/server/lib/prisma";
|
||||
|
||||
const role = [
|
||||
{
|
||||
id: "developer",
|
||||
name: "developer"
|
||||
},
|
||||
{
|
||||
id: "admin",
|
||||
name: "admin"
|
||||
},
|
||||
{
|
||||
id: "pelaksana",
|
||||
name: "pelaksana"
|
||||
}
|
||||
]
|
||||
|
||||
const user = [
|
||||
{
|
||||
name: "Bip",
|
||||
email: "bip@bip.com",
|
||||
password: "bip",
|
||||
roleId: "developer"
|
||||
}
|
||||
];
|
||||
|
||||
; (async () => {
|
||||
(async () => {
|
||||
for (const u of user) {
|
||||
await prisma.user.upsert({
|
||||
where: { email: u.email },
|
||||
create: u,
|
||||
update: u,
|
||||
update: u
|
||||
})
|
||||
|
||||
console.log(`✅ User ${u.email} seeded successfully`)
|
||||
}
|
||||
|
||||
for (const r of role) {
|
||||
console.log(`Seeding role ${r.name}`)
|
||||
await prisma.role.upsert({
|
||||
where: { id: r.id },
|
||||
create: r,
|
||||
update: r
|
||||
})
|
||||
|
||||
console.log(`✅ Role ${r.name} seeded successfully`)
|
||||
}
|
||||
|
||||
|
||||
})().catch((e) => {
|
||||
console.error(e)
|
||||
|
||||
Reference in New Issue
Block a user