import { prisma } from '../src/lib/prisma' async function main() { if ((await prisma.role.count()) === 0) { await prisma.role.upsert({ where: { id: 0, name: 'Admin' }, update: {}, create: { name: 'Admin', }, }) } if ((await prisma.inventory.count()) === 0) { await prisma.inventory.createMany({ data: [ { name: 'انبار مرکزی', location: 'تهران', isPointOfSale: false, isActive: true }, { name: 'فروشگاه حضوری', location: 'مرکز شهر', isPointOfSale: true, isActive: true, }, { name: 'فروشگاه اینترنتی', location: 'مرکز شهر', isPointOfSale: true, isActive: true, }, ], }) } if ((await prisma.productCategory.count()) === 0) { await prisma.productCategory.createMany({ data: [{ name: 'دسته‌ی ۱' }, { name: 'دسته‌ی ۲' }, { name: 'دسته‌ی ۳' }], }) } if ((await prisma.productBrand.count()) === 0) { await prisma.productBrand.createMany({ data: [{ name: 'برند ۱' }, { name: 'برند ۲' }, { name: 'برند ۳' }], }) } if ((await prisma.supplier.count()) === 0) { await prisma.supplier.createMany({ data: [ { firstName: 'تامین‌', lastName: 'کننده ۱', mobileNumber: '09120000001', email: 'supplier1@example.com', }, { firstName: 'تامین‌', lastName: 'کننده ۲', mobileNumber: '09120000002', email: 'supplier2@example.com', }, { firstName: 'تامین‌', lastName: 'کننده 3', mobileNumber: '09120000003', email: 'supplier3@example.com', }, ], }) } } main() .then(async () => { await prisma.$disconnect() }) .catch(async e => { console.error(e) await prisma.$disconnect() process.exit(1) })