import { PrismaClient, Role, SpaceType } from '@prisma/client'; import * as bcrypt from 'bcrypt'; const prisma = new PrismaClient(); async function main() { const hashedPassword = await bcrypt.hash('admin123', 10); const org = await prisma.organization.upsert({ where: { id: 'test-org-id' }, update: {}, create: { id: 'test-org-id', name: 'Test Organization', }, }); const admin = await prisma.user.upsert({ where: { email: 'admin@example.com' }, update: {}, create: { email: 'admin@example.com', password: hashedPassword, role: Role.ADMIN, organizationId: org.id, }, }); const building = await prisma.building.create({ data: { name: 'Headquarters', organizationId: org.id, floors: { create: [ { number: 1, spaces: { create: [ { name: 'Desk 101', type: SpaceType.DESK, x: 10, y: 10 }, { name: 'Meeting Room A', type: SpaceType.MEETING_ROOM, x: 50, y: 50 }, { name: 'Kitchen', type: SpaceType.AMENITY, x: 80, y: 80 }, ], }, }, { number: 2, spaces: { create: [ { name: 'Desk 201', type: SpaceType.DESK, x: 20, y: 20 }, { name: 'Boardroom', type: SpaceType.MEETING_ROOM, x: 60, y: 60 }, ], }, }, ], }, }, }); console.log({ org, admin, building }); } main() .catch((e) => { console.error(e); process.exit(1); }) .finally(async () => { await prisma.$disconnect(); });