import prisma from '../../src/prisma/PrismaClient'; interface VendorInput { name: string; name_pt: string; strengths: string; weaknesses: string; website: string; } export async function seedVendors(): Promise { try { // Cari user dengan username admin1 const adminUser = await prisma.user.findFirst({ where: { username: 'admin1', }, }); if (!adminUser) { throw new Error('User with username admin1 not found'); } // Daftar vendor const vendors: VendorInput[] = [ { name: 'MediSoft SIMRS', name_pt: 'PT Medisoft Technology', strengths: 'Antarmuka user-friendly, support lengkap untuk modul RS', weaknesses: 'Harga relatif tinggi', website: 'https://medisoft.co.id', }, { name: 'SimRS Platinum', name_pt: 'PT Platinum Healthtech', strengths: 'Integrasi BPJS dan telemedicine', weaknesses: 'Customisasi sulit', website: 'https://simrsplatinum.id', }, { name: 'Hospicare System', name_pt: 'PT Hospicare Nusantara', strengths: 'Stabil dan dokumentasi lengkap', weaknesses: 'Kurang inovatif', website: 'https://hospicare.co.id', }, ]; // Insert ke database for (const vendor of vendors) { await prisma.vendor.create({ data: { ...vendor, created_by: adminUser.id, }, }); } console.log('✅ Vendor seeded!'); } catch (error: any) { console.error('❌ Error seeding vendor:', error.message); } } // const prisma = require('../../src/prisma/PrismaClient.js'); // async function seedVendors() { // try { // // cari user role admin // const adminUser = await prisma.user.findFirst({ // where: { // username: 'admin1', // }, // }); // if (!adminUser) { // throw new Error('User with role admin not exists'); // } // // Data vendor yang akan dimasukkan // const vendors = [ // { // name: 'MediSoft SIMRS', // name_pt: 'PT Medisoft Technology', // strengths: 'Antarmuka user-friendly, support lengkap untuk modul RS', // weaknesses: 'Harga relatif tinggi', // website: 'https://medisoft.co.id', // }, // { // name: 'SimRS Platinum', // name_pt: 'PT Platinum Healthtech', // strengths: 'Integrasi BPJS dan telemedicine', // weaknesses: 'Customisasi sulit', // website: 'https://simrsplatinum.id', // }, // { // name: 'Hospicare System', // name_pt: 'PT Hospicare Nusantara', // strengths: 'Stabil dan dokumentasi lengkap', // weaknesses: 'Kurang inovatif', // website: 'https://hospicare.co.id', // }, // ]; // // Insert vendor dengan created_by dari adminUser.id // for (const vendor of vendors) { // await prisma.vendor.create({ // data: { // ...vendor, // created_by: adminUser.id, // }, // }); // } // console.log('✅ Vendor seeded!'); // } catch (error) { // console.error('❌ Error seeding vendor:', error); // } // } // module.exports = { seedVendors };