sort get secrets response for etags

This commit is contained in:
Maidul Islam
2024-02-02 01:24:46 -05:00
parent b6eb08167f
commit 72d46efba5
2 changed files with 11 additions and 5 deletions

View File

@@ -25,10 +25,15 @@ export const fnSecretsFromImports = async ({
if (!folderIds.length) { if (!folderIds.length) {
return []; return [];
} }
const importedSecrets = await secretDAL.find({ const importedSecrets = await secretDAL.find(
$in: { folderId: folderIds }, {
type: SecretType.Shared $in: { folderId: folderIds },
}); type: SecretType.Shared
},
{
sort: [["createdAt", "desc"]]
}
);
const importedSecsGroupByFolderId = groupBy(importedSecrets, (i) => i.folderId); const importedSecsGroupByFolderId = groupBy(importedSecrets, (i) => i.folderId);
return allowedImports.map(({ importPath, importEnv }, i) => ({ return allowedImports.map(({ importPath, importEnv }, i) => ({

View File

@@ -86,7 +86,8 @@ export const secretDALFactory = (db: TDbClient) => {
.select(db.ref("id").withSchema(TableName.SecretTag).as("tagId")) .select(db.ref("id").withSchema(TableName.SecretTag).as("tagId"))
.select(db.ref("color").withSchema(TableName.SecretTag).as("tagColor")) .select(db.ref("color").withSchema(TableName.SecretTag).as("tagColor"))
.select(db.ref("slug").withSchema(TableName.SecretTag).as("tagSlug")) .select(db.ref("slug").withSchema(TableName.SecretTag).as("tagSlug"))
.select(db.ref("name").withSchema(TableName.SecretTag).as("tagName")); .select(db.ref("name").withSchema(TableName.SecretTag).as("tagName"))
.orderBy("createdAt", "desc");
const data = sqlNestRelationships({ const data = sqlNestRelationships({
data: secs, data: secs,
key: "id", key: "id",