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

View File

@@ -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({
secretName,
workspaceId: new Types.ObjectId(workspaceId),

View File

@@ -1,9 +1,9 @@
import { ISecret } from "../models";
import {
createSecretReminderCron,
deleteSecretReminderCron,
updateSecretReminderCron
} from "../queues/reminders/sendSecretReminders";
import { ISecret } from "../models";
type TPartialSecret = Pick<
ISecret,

View File

@@ -1,7 +1,7 @@
import { Types } from "mongoose";
import { sendMail } from "../../helpers";
import Queue, { Job } from "bull";
import { IUser, Membership, Organization, Workspace } from "../../models";
import { Types } from "mongoose";
import { sendMail } from "../../helpers";
type TSendSecretReminders = {
workspaceId: string;