prisma.table.count({
where: {
OR: flag1
? undefined
: [
{
fKey1: id
},
{
foreignTable1: { // Foreign key 1 points to this table
parentId: id
}
}
],
tenantId: user.tenantId ?? undefined,
fKey2: flag1 ? id : undefined,
AND:
aPermissionsCondition
? [
{
OR: [
{foreignTable3: {visibility: Visibility.PUBLIC}},
{foreignTable3: {visibility: Visibility.CREATOR_ONLY, userId: user.id}},
{fKey3: null}
]
}
]
: [],
anotherProperty: {
in: anArray
}
}
})
prisma.table.count({
where: {
OR: flag1
? undefined
: [
{
fKey1: id
},
{
foreignTable1: { // Foreign key 1 points to this table
parentId: id
}
}
],
tenantId: user.tenantId ?? undefined,
fKey2: flag1 ? id : undefined,
AND:
aPermissionsCondition
? [
{
OR: [
{foreignTable3: {visibility: Visibility.PUBLIC}},
{foreignTable3: {visibility: Visibility.CREATOR_ONLY, userId: user.id}},
{fKey3: null}
]
}
]
: [],
anotherProperty: {
in: anArray
}
}
})