feat: fixed count inconsistency

This commit is contained in:
=
2025-10-22 02:04:55 +05:30
parent 008b67738b
commit 083e8e605f

View File

@@ -413,10 +413,12 @@ export const projectDALFactory = (db: TDbClient) => {
const countOfOrgProjects = async (orgId: string | null, tx?: Knex) => {
try {
const subOrgProjects = db.replicaNode()(TableName.Organization).where({ rootOrgId: orgId }).select("id");
const doc = await (tx || db.replicaNode())(TableName.Project)
.andWhere((bd) => {
if (orgId) {
void bd.where({ orgId });
void bd.where({ orgId }).orWhereIn("orgId", subOrgProjects);
}
})
.count();