mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
revert changes on findByProjectIdBridgeSecretV2
This commit is contained in:
@@ -710,7 +710,6 @@ export const secretApprovalRequestDALFactory = (db: TDbClient) => {
|
|||||||
db.ref("firstName").withSchema("committerUser").as("committerUserFirstName"),
|
db.ref("firstName").withSchema("committerUser").as("committerUserFirstName"),
|
||||||
db.ref("lastName").withSchema("committerUser").as("committerUserLastName")
|
db.ref("lastName").withSchema("committerUser").as("committerUserLastName")
|
||||||
)
|
)
|
||||||
.distinctOn(`${TableName.SecretApprovalRequest}.id`)
|
|
||||||
.as("inner");
|
.as("inner");
|
||||||
|
|
||||||
const query = (tx || db).select("*").from(innerQuery).orderBy("createdAt", "desc") as typeof innerQuery;
|
const query = (tx || db).select("*").from(innerQuery).orderBy("createdAt", "desc") as typeof innerQuery;
|
||||||
@@ -731,13 +730,11 @@ export const secretApprovalRequestDALFactory = (db: TDbClient) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
const countQuery = (await (tx || db)
|
||||||
const countResult = await (tx || db.replicaNode())
|
.select(db.raw("count(*) OVER() as total_count"))
|
||||||
.count({ count: "*" })
|
.from(query.clone().as("outer"))) as Array<{
|
||||||
.from(query.clone().as("count_query"))
|
total_count: number;
|
||||||
.first();
|
}>;
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
||||||
const totalCount = Number(countResult?.count || 0);
|
|
||||||
|
|
||||||
const rankOffset = offset + 1;
|
const rankOffset = offset + 1;
|
||||||
const docs = await (tx || db)
|
const docs = await (tx || db)
|
||||||
@@ -747,6 +744,8 @@ export const secretApprovalRequestDALFactory = (db: TDbClient) => {
|
|||||||
.where("w.rank", ">=", rankOffset)
|
.where("w.rank", ">=", rankOffset)
|
||||||
.andWhere("w.rank", "<", rankOffset + limit);
|
.andWhere("w.rank", "<", rankOffset + limit);
|
||||||
|
|
||||||
|
const totalCount = Number(countQuery[0]?.total_count || 0);
|
||||||
|
|
||||||
const formattedDoc = sqlNestRelationships({
|
const formattedDoc = sqlNestRelationships({
|
||||||
data: docs,
|
data: docs,
|
||||||
key: "id",
|
key: "id",
|
||||||
|
|||||||
Reference in New Issue
Block a user