mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 04:27:29 +00:00
feat: fixed count inconsistency
This commit is contained in:
@@ -413,10 +413,12 @@ export const projectDALFactory = (db: TDbClient) => {
|
|||||||
|
|
||||||
const countOfOrgProjects = async (orgId: string | null, tx?: Knex) => {
|
const countOfOrgProjects = async (orgId: string | null, tx?: Knex) => {
|
||||||
try {
|
try {
|
||||||
|
const subOrgProjects = db.replicaNode()(TableName.Organization).where({ rootOrgId: orgId }).select("id");
|
||||||
|
|
||||||
const doc = await (tx || db.replicaNode())(TableName.Project)
|
const doc = await (tx || db.replicaNode())(TableName.Project)
|
||||||
.andWhere((bd) => {
|
.andWhere((bd) => {
|
||||||
if (orgId) {
|
if (orgId) {
|
||||||
void bd.where({ orgId });
|
void bd.where({ orgId }).orWhereIn("orgId", subOrgProjects);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.count();
|
.count();
|
||||||
|
|||||||
Reference in New Issue
Block a user