Skip to content

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

improvement: make limit conditional

Scott Wilson93f27a7ee8e3
diff --git a/backend/src/services/identity-project/identity-project-dal.ts b/backend/src/services/identity-project/identity-project-dal.ts
index 3a73244a44..3e7ca7946f 100644
--- a/backend/src/services/identity-project/identity-project-dal.ts
+++ b/backend/src/services/identity-project/identity-project-dal.ts
@@ -131,8 +131,6 @@ export const identityProjectDALFactory = (db: TDbClient) => {
`${TableName.Identity}.id`
)
.where(`${TableName.IdentityProjectMembership}.projectId`, projectId)
- .offset(filter.offset ?? 0)
- .limit(filter.limit ?? 100)
.orderBy(
`${TableName.Identity}.${filter.orderBy ?? ProjectIdentityOrderBy.Name}`,
filter.orderDirection ?? OrderByDirection.ASC
@@ -140,6 +138,10 @@ export const identityProjectDALFactory = (db: TDbClient) => {
.select(selectAllTableCols(TableName.Identity))
.as(TableName.Identity); // required for subqueries
+ if (filter.limit) {
+ void fetchIdentitySubquery.offset(filter.offset ?? 0).limit(filter.limit);
+ }
+
const query = (tx || db.replicaNode())(TableName.IdentityProjectMembership)
.where(`${TableName.IdentityProjectMembership}.projectId`, projectId)
.join(TableName.Project, `${TableName.IdentityProjectMembership}.projectId`, `${TableName.Project}.id`)