Devin
10/28/2021, 4:08 AMconst projects = ["project 1", "project 2"]
projects.forEach(async (p) => await db.project.create({data: {name: p}})
const dbProjects = db.project.findMany()
db.task.create({
data: {
name: 'some task',
project: {connect: {id: dbProject.find((p) => p.name.includes("project 1")).id},
I’m getting TS errors with dbProject.find because of course it could be undefined… Is there a better way to be thinking about this?Ryan
10/28/2021, 5:02 AMmap and Promise.all so that the Project is always available when you perform a dbProject.findDevin
10/28/2021, 5:05 AM