///
return context.entities.TipoEPI.create(....
///entity TipoEPI {=psl
id Int @id @default(autoincrement())
nome String
descricao String
epi EPI[]
psl=}
/* .... */
action createTipoEPI {
fn: import {createTipoEPI} from "@src/epis/actions",
entities: [TipoEPI]
}
export const createTipoEPI = (args, context) => {
return context.entities.TipoEPI.create({
data: {
nome: args.nome,
descricao: args.descricao
}
})
}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.');
});
}Join the Discord to ask follow-up questions and connect with the community
Rails-like framework for React, Node.js and Prisma. Build your app in a day and deploy it with a single CLI command.
4,603 Members
Join