mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-08 15:28:25 +00:00
Update project-bot-service.ts
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
import { ForbiddenError } from "@casl/ability";
|
import { ForbiddenError } from "@casl/ability";
|
||||||
import { Knex } from "knex";
|
|
||||||
|
|
||||||
import { SecretKeyEncoding } from "@app/db/schemas";
|
import { SecretKeyEncoding } from "@app/db/schemas";
|
||||||
import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service";
|
import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service";
|
||||||
@@ -106,16 +105,12 @@ export const projectBotServiceFactory = ({ projectBotDAL, permissionService }: T
|
|||||||
if (!botKey?.nonce || !botKey?.encryptedKey) {
|
if (!botKey?.nonce || !botKey?.encryptedKey) {
|
||||||
throw new BadRequestError({ message: "Failed to set bot active - missing bot key" });
|
throw new BadRequestError({ message: "Failed to set bot active - missing bot key" });
|
||||||
}
|
}
|
||||||
const doc = await projectBotDAL.updateById(
|
const doc = await projectBotDAL.updateById(botId, {
|
||||||
botId,
|
|
||||||
{
|
|
||||||
isActive: true,
|
isActive: true,
|
||||||
encryptedProjectKey: botKey.encryptedKey,
|
encryptedProjectKey: botKey.encryptedKey,
|
||||||
encryptedProjectKeyNonce: botKey.nonce,
|
encryptedProjectKeyNonce: botKey.nonce,
|
||||||
senderId: actorId
|
senderId: actorId
|
||||||
},
|
});
|
||||||
tx
|
|
||||||
);
|
|
||||||
if (!doc) throw new BadRequestError({ message: "Failed to update bot active state" });
|
if (!doc) throw new BadRequestError({ message: "Failed to update bot active state" });
|
||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user