export const seedTipoEPI = async (prisma) => {
const results = [];
const csvFilePath = resolve(__dirname, '../../../../src/seeds/tipoepi.csv');
fs.createReadStream(csvFilePath)
.pipe(csv())
.on('data', (data) => results.push(data))
.on('end', async () => {
for (const item of results) {
await createTipoEPI(prisma, {
nome: item.type
});
}
console.log('Successfully seeded TipoEPI data.');
});
}
export const seedTipoEPI = async (prisma) => {
const results = [];
const csvFilePath = resolve(__dirname, '../../../../src/seeds/tipoepi.csv');
fs.createReadStream(csvFilePath)
.pipe(csv())
.on('data', (data) => results.push(data))
.on('end', async () => {
for (const item of results) {
await createTipoEPI(prisma, {
nome: item.type
});
}
console.log('Successfully seeded TipoEPI data.');
});
}