mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 15:41:27 +00:00
Fixed integrations & bulk update issue
This commit is contained in:
@@ -60,16 +60,14 @@ export const secretDALFactory = (db: TDbClient) => {
|
||||
throw new BadRequestError({ message: "Some of the secrets do not exist" });
|
||||
}
|
||||
|
||||
if (data.length === 0) return [];
|
||||
|
||||
const updatedSecrets = await (tx || db)(TableName.Secret)
|
||||
.insert(data)
|
||||
.onConflict("id") // this will cause a conflict then merge the data
|
||||
.merge() // Merge the data with the existing data
|
||||
.returning("*");
|
||||
|
||||
if (!updatedSecrets || updatedSecrets.length === 0) {
|
||||
throw new BadRequestError({ message: "Failed to bulk update secret approvals" });
|
||||
}
|
||||
|
||||
return updatedSecrets;
|
||||
} catch (error) {
|
||||
throw new DatabaseError({ error, name: "bulk update secret" });
|
||||
|
||||
@@ -73,16 +73,14 @@ export const secretVersionDALFactory = (db: TDbClient) => {
|
||||
throw new BadRequestError({ message: "Some of the secret versions do not exist" });
|
||||
}
|
||||
|
||||
if (data.length === 0) return [];
|
||||
|
||||
const updatedSecretVersions = await (tx || db)(TableName.SecretVersion)
|
||||
.insert(data)
|
||||
.onConflict("id") // this will cause a conflict then merge the data
|
||||
.merge() // Merge the data with the existing data
|
||||
.returning("*");
|
||||
|
||||
if (!updatedSecretVersions || updatedSecretVersions.length === 0) {
|
||||
throw new BadRequestError({ message: "Failed to bulk update secret versions" });
|
||||
}
|
||||
|
||||
return updatedSecretVersions;
|
||||
} catch (error) {
|
||||
throw new DatabaseError({ error, name: "bulk update secret" });
|
||||
|
||||
Reference in New Issue
Block a user