Debaucus
05/26/2022, 12:59 AMawait prisma.X.findUnique
with X being the changing variable.
OR, is this a database stucture issue and I need to rethink my design?Omar
05/26/2022, 7:30 AMconst modelName = id ? "car" : "truck"
await prisma[modelName].findUnique
You might need to add //@ts-ignore before it in case you're using typescript though.Nurul
05/26/2022, 10:49 AMif condition as well
Like
if(id === 'x'){
await prisma.x.findUnique()
}else{
await prisma.y.findMany()
}