sort get secrets response for etags

This commit is contained in:
Maidul Islam
2024-02-02 01:25:19 -05:00
parent b6eb08167f
commit 72d46efba5
2 changed files with 11 additions and 5 deletions
@@ -25,10 +25,15 @@ export const fnSecretsFromImports = async ({
if (!folderIds.length) {
return [];
}
const importedSecrets = await secretDAL.find({
$in: { folderId: folderIds },
type: SecretType.Shared
});
const importedSecrets = await secretDAL.find(
{
$in: { folderId: folderIds },
type: SecretType.Shared
},
{
sort: [["createdAt", "desc"]]
}
);
const importedSecsGroupByFolderId = groupBy(importedSecrets, (i) => i.folderId);
return allowedImports.map(({ importPath, importEnv }, i) => ({