Angelo
02/04/2021, 8:06 PM$transaction
I would like to get the locations that were created but Prisma only returns the main object that was created and not the nested ones
export default {
create: async (prisma, customers) => {
const maincontractors = allData.map((data) => {
const newData = {
...data,
customers: {
connect: customers
.filter((customer) => data.customers.includes(customer.name))
.map((customer) => ({ id: customer.id })),
},
locations: {
create: maincontractorLocationData.get(data.name),
},
};
return prisma.maincontractor.create({ data: newData });
});
return prisma.$transaction(maincontractors);
},
};
Is there a way that I can retrieve the location
that were created?Ryan
02/05/2021, 6:38 AMinclude
in this statement:
return prisma.maincontractor.create({ data: newData });
as mentioned here with the name of your relation.