Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

feat: fixed count inconsistency

=083e8e605f2d
diff --git a/backend/src/services/project/project-dal.ts b/backend/src/services/project/project-dal.ts
index 2abdebdbcb..11d4239db0 100644
--- a/backend/src/services/project/project-dal.ts
+++ b/backend/src/services/project/project-dal.ts
@@ -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();