Some more fixes for python structure

This commit is contained in:
Daniel Hougaard
2024-01-29 16:55:36 +04:00
parent 5aeb8f6b03
commit 8ade2f3758
5 changed files with 28 additions and 8 deletions
@@ -37,7 +37,12 @@ export const fnSecretsFromImports = async ({
environmentInfo: importEnv,
folderId: importedFolders?.[i]?.id,
secrets: importedFolders?.[i]?.id
? importedSecsGroupByFolderId[importedFolders?.[i]?.id as string]
? importedSecsGroupByFolderId[importedFolders?.[i]?.id as string].map((item) => ({
...item,
environment: importEnv.slug,
workspace: "", // This field should not be used, it's only here to keep the older Python SDK versions backwards compatible with the new Postgres backend.
_id: item.id // The old Python SDK depends on the _id field being returned. We return this to keep the older Python SDK versions backwards compatible with the new Postgres backend.
}))
: []
}));
};
+1 -1
View File
@@ -109,7 +109,7 @@ export const secretDALFactory = (db: TDbClient) => {
const data = sqlNestRelationships({
data: secs,
key: "id",
parentMapper: (el) => SecretsSchema.parse(el),
parentMapper: (el) => ({ _id: el.id, ...SecretsSchema.parse(el) }),
childrenMapper: [
{
key: "tagId",
@@ -145,7 +145,7 @@ export const secretServiceFactory = ({
await secretVersionTagDAL.insertMany(newSecretVersionTags, tx);
}
return newSecrets;
return newSecrets.map((secret) => ({ ...secret, _id: secret.id }));
};
const fnSecretBulkUpdate = async ({
@@ -194,7 +194,7 @@ export const secretServiceFactory = ({
}
}
return newSecrets;
return newSecrets.map((secret) => ({ ...secret, _id: secret.id }));
};
const fnSecretBulkDelete = async ({
@@ -539,7 +539,7 @@ export const secretServiceFactory = ({
await secretQueueService.syncSecrets({ secretPath: path, projectId, environment });
// TODO(akhilmhdh-pg): licence check, posthog service and snapshot
return { ...deletedSecret[0], workspace: projectId, environment };
return { ...deletedSecret[0], _id: deletedSecret[0].id, workspace: projectId, environment };
};
const getSecrets = async ({