Merge branch 'daniel/assignment' of https://github.com/DanielHougaard/infisical into daniel/assignment

This commit is contained in:
Daniel Hougaard
2023-11-28 01:25:42 +04:00
3 changed files with 35 additions and 3 deletions
@@ -1138,6 +1138,38 @@ export const updateSecretByName = async (req: Request, res: Response) => {
} }
} }
if (type !== "personal") {
const existingSecret = await SecretService.getSecret({
secretName,
workspaceId: new Types.ObjectId(workspaceId),
environment,
type,
secretPath,
authData: req.authData
});
if (
(secretReminderCron && existingSecret.secretReminderCron !== secretReminderCron) ||
(secretReminderNote && existingSecret.secretReminderNote !== secretReminderNote)
) {
await createReminder(existingSecret, {
_id: existingSecret._id,
secretReminderCron,
secretReminderNote,
workspace: existingSecret.workspace
});
} else if (
secretReminderCron === null &&
secretReminderNote === null &&
existingSecret.secretReminderCron
) {
await deleteReminder({
_id: existingSecret._id,
secretReminderCron: existingSecret.secretReminderCron
});
}
}
const secret = await SecretService.updateSecret({ const secret = await SecretService.updateSecret({
secretName, secretName,
workspaceId: new Types.ObjectId(workspaceId), workspaceId: new Types.ObjectId(workspaceId),
+1 -1
View File
@@ -1,9 +1,9 @@
import { ISecret } from "../models";
import { import {
createSecretReminderCron, createSecretReminderCron,
deleteSecretReminderCron, deleteSecretReminderCron,
updateSecretReminderCron updateSecretReminderCron
} from "../queues/reminders/sendSecretReminders"; } from "../queues/reminders/sendSecretReminders";
import { ISecret } from "../models";
type TPartialSecret = Pick< type TPartialSecret = Pick<
ISecret, ISecret,
@@ -1,7 +1,7 @@
import { Types } from "mongoose";
import { sendMail } from "../../helpers";
import Queue, { Job } from "bull"; import Queue, { Job } from "bull";
import { IUser, Membership, Organization, Workspace } from "../../models"; import { IUser, Membership, Organization, Workspace } from "../../models";
import { Types } from "mongoose";
import { sendMail } from "../../helpers";
type TSendSecretReminders = { type TSendSecretReminders = {
workspaceId: string; workspaceId: string;