Could someone help me with one to many relation in prisma?

I have a cron job that create a list of records from different tables. Those table items need to be linked (have foreign key) with record of tables. Following is my Prisma schema and the cron api.
Solution
const savedReportDB = await prisma.reportDatabse.create({
  data: {
    userId,
    generatedFor: yesterday,
    savedWeight: {
      connect: savedWeight.map((weight) => ({ weightId: weight.weightId })),
    },
    savedLiter: {
      connect: savedLiter.map((liter) => ({ literId: liter.literId })),
    },
    savedPieceCounting: {
      connect: savedPieceCounting.map((piece) => ({ pieceId: piece.pieceId })),
    },
    savedGrades: {
      connect: savedGrades.map((grade) => ({ gradeId: grade.gradeId })),
    },
    AlertDatabase: {
      connect: AlertDatabase.map((alert) => ({ alertId: alert.alertId })),
    },
  },
});

^^ If they're all arrays
Was this page helpful?