Michael Jay
07/11/2022, 2:16 PMthis.prisma.role.update({
where: { id: incomingRole.id },
data: {
name: incomingRole.name,
permissions: {
deleteMany: {
id: { in: permissionsToDelete.map(permission => permission.id) }
},
create: permissionsToCreate.map(permissionName => {
return {
name: permissionName
}
})
}
}
})
But now I'm thinking that would instead delete and create actually Permission records, instead of deleting rolePermission records.
Update: I decided to just explicitly define the join. I really love the implicit join syntax, but reading through the Prisma docs, it seems like to use them in queries, I have to explicitly define them.