what is Prisma.BatchPayload?

const insertIntoTradesRes = await ctx.db.trade.createMany({ data: trades });

const insertedTradeIds = insertIntoTradesRes.map(trade => trade.id);

await ctx.db.importSession.create({
data: {
name: 'MT4 Import',
importedFrom: 'MT4',
createdBy: { connect: { id: ctx.session.user.id } },
trades: { connect: insertedTradeIds },
},
});
const insertIntoTradesRes = await ctx.db.trade.createMany({ data: trades });

const insertedTradeIds = insertIntoTradesRes.map(trade => trade.id);

await ctx.db.importSession.create({
data: {
name: 'MT4 Import',
importedFrom: 'MT4',
createdBy: { connect: { id: ctx.session.user.id } },
trades: { connect: insertedTradeIds },
},
});
I'm trying to make an insertion into the trade table and then use the ids generated to connect those trades created in another table. however I'm unable to as the return type from createMany is Prisma.BatchPayload Can anyone help me achieve this without manually creating and assigning uuids
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server