mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
improvement: make limit conditional
This commit is contained in:
@@ -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`)
|
||||
|
||||
Reference in New Issue
Block a user