37 lines
805 B
TypeScript
37 lines
805 B
TypeScript
import { PrismaClient, UserRole } from "@prisma/client";
|
||
|
||
const prisma = new PrismaClient();
|
||
|
||
async function main() {
|
||
const tenant = await prisma.tenant.upsert({
|
||
where: { slug: "moraworld" },
|
||
update: {},
|
||
create: {
|
||
slug: "moraworld",
|
||
name: "Moraworld Imports",
|
||
},
|
||
});
|
||
|
||
console.log("✓ Tenant:", tenant.slug);
|
||
|
||
const suiteCode = "EC-00001";
|
||
const demoEmail = "demo@moraworld.test";
|
||
|
||
const existing = await prisma.user.findUnique({
|
||
where: { tenantId_email: { tenantId: tenant.id, email: demoEmail } },
|
||
});
|
||
|
||
if (!existing) {
|
||
console.log("ℹ Usuario demo se creará en Fase 1 (auth con bcrypt)");
|
||
}
|
||
|
||
console.log("✓ Seed completado");
|
||
}
|
||
|
||
main()
|
||
.catch((e) => {
|
||
console.error(e);
|
||
process.exit(1);
|
||
})
|
||
.finally(() => prisma.$disconnect());
|