mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 06:28:11 +00:00
improvement: make limit conditional
This commit is contained in:
@@ -131,8 +131,6 @@ export const identityProjectDALFactory = (db: TDbClient) => {
|
|||||||
`${TableName.Identity}.id`
|
`${TableName.Identity}.id`
|
||||||
)
|
)
|
||||||
.where(`${TableName.IdentityProjectMembership}.projectId`, projectId)
|
.where(`${TableName.IdentityProjectMembership}.projectId`, projectId)
|
||||||
.offset(filter.offset ?? 0)
|
|
||||||
.limit(filter.limit ?? 100)
|
|
||||||
.orderBy(
|
.orderBy(
|
||||||
`${TableName.Identity}.${filter.orderBy ?? ProjectIdentityOrderBy.Name}`,
|
`${TableName.Identity}.${filter.orderBy ?? ProjectIdentityOrderBy.Name}`,
|
||||||
filter.orderDirection ?? OrderByDirection.ASC
|
filter.orderDirection ?? OrderByDirection.ASC
|
||||||
@@ -140,6 +138,10 @@ export const identityProjectDALFactory = (db: TDbClient) => {
|
|||||||
.select(selectAllTableCols(TableName.Identity))
|
.select(selectAllTableCols(TableName.Identity))
|
||||||
.as(TableName.Identity); // required for subqueries
|
.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)
|
const query = (tx || db.replicaNode())(TableName.IdentityProjectMembership)
|
||||||
.where(`${TableName.IdentityProjectMembership}.projectId`, projectId)
|
.where(`${TableName.IdentityProjectMembership}.projectId`, projectId)
|
||||||
.join(TableName.Project, `${TableName.IdentityProjectMembership}.projectId`, `${TableName.Project}.id`)
|
.join(TableName.Project, `${TableName.IdentityProjectMembership}.projectId`, `${TableName.Project}.id`)
|
||||||
|
|||||||
Reference in New Issue
Block a user